• Get In Touch
May 29, 2017

How to Install PimCore CMS on Ubuntu 16.04

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Pimcore is a free and open source platform for content management (CMS), product information management (PIM), digital asset management (DAM) based on the Zend Framework.

Pimcore allow us to manage and share all of our digital assets across any channel.

Pimcore is a web-based application written in PHP language and the MySQL/MariaDB relational database management system.

You can easily create and manage digital experiences for various output channels like, mobile, web, apps, print, social platform and much more.

In this tutorial, we will learn how to install Pimcore CMS on Ubuntu 16.04 server.

Requirements

  • A server running Ubuntu 16.04 server.
  • A non root user with sudo privileges setup on your server.

Update the System

Before installing any packages, it is recommended to update your system with the latest version. You can do this by running the following command:

sudo apt-get update -y
sudo apt-get upgrade -y

Once your system is up to date, you can proceed to the next step.

Install Nginx

First, you will need to install Nginx web server to your system. You can install it with the following command:

sudo apt-get install nginx

Once Nginx is installed, start Nginx service and enable it to start on boot with the following command:

sudo systemctl start nginx
sudo systemctl enable nginx

Install PHP and PHP-FTP

Next, you will need to install PHP, PHP-FPM and other required PHP modules to your system. You can install all of them by running the following command:

sudo apt-get install php7.0 php7.0-fpm php7.0-cli php7.0-json php7.0-curl php7.0-gd php7.0-mysql -y

Once all the packages are installed, you will need to make some changes in php.ini file:

sudo nano /etc/php/7.0/fpm/php.ini

Change the following lines:

memory_limit = 512M
date.timezone = UTC
post_max_size = 200M

Save and close the file when you are finished.

Next, create a new PHP-FPM pool for your user.

sudo nano /etc/php/7.0/fpm/pool.d/www-data.conf

Add the following lines:

[www-data]
user = www-data
group = www-data
listen = /run/php/php7.0-www-data.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0666
pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 10s
pm.max_requests = 200
chdir = /

Save and close the file then restart PHP-FPM servcie with the following command:

sudo systemctl restart php7.0-fpm

Install and Configure MariaDB

You will need to install MariaDB server to store data. You can install it with the following command:

sudo apt-get install mariadb-server -y

Start MariaDB and enable it to automatically start at boot time.

sudo systemctl start mysql
sudo systemctl enable mysql

By default, MariaDB is not secured, so you will need to secure it first. You can secure it by running the mysql_secure_installation script.

sudo mysql_secure_installation

Answer all the questions as shown below:

Set root password? [Y/n] n
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

Once MariaDB is secured, log in to the MySQL shell and create a database for Pimcore:

mysql -u root -p

Enter your root password when prompt, then create a database for Pimcore. It is recommended to set secure password:

MariaDB [(none)]>CREATE DATABASE pimcore;

Query OK, 1 row affected (0.00 sec)

Next, create a username and password for Pimcore with the following command:

MariaDB [(none)]>CREATE USER 'pimuser'@'localhost' IDENTIFIED BY 'password';

Query OK, 1 row affected (0.00 sec)

Next, grant privileges to the Pimcore database with the following command:

MariaDB [(none)]>GRANT ALL PRIVILEGES ON pimcore.* TO 'pimuser'@'localhost';

Query OK, 1 row affected (0.00 sec)

Next, you will need to run the FLUSH PRIVILEGES command so that the privileges table will be reloaded by MariaDB and we can use new credential:

MariaDB [(none)]>FLUSH PRIVILEGES;

Query OK, 1 row affected (0.00 sec)

Next, exit from the MariaDB console with the following command:

MariaDB [(none)]>\q

Once you are done, you can proceed to the next step.

Install Pimcore

First, you will need to download the latest version of the Pimcore. You can download it from their official website with the following command:

wget https://www.pimcore.org/download/pimcore-data.zip

Once the download is complete, unzip the downloaded file to the apache web root directory with the following command:

sudo mkdir /var/www/html/pimcore
sudo unzip pimcore-data.zip -d /var/www/html/pimcore/

Next, change the ownership of the pimcore directory with the following command:

sudo chown -R www-data:www-data /var/www/html/pimcore/

Configure Nginx for Pimcore

Next, you will need to create a virtual server block for Pimcore. You can do this by creating pimcore.conf file inside /etc/nginx/sites-available/ directory.

sudo nano /etc/nginx/sites-available/pimcore.conf

Add the following lines:

server {
    listen 80;
    server_name yourdomain.com;
    root /var/www/html/pimcore/;
    index index.php;

    access_log  /var/log/nginx/pimcore.access.log;
    error_log   /var/log/nginx/pimcore.error.log;

    set $getassets "";
    if ($uri ~* ^/website/var/assets)   { set $getassets "${getassets}A"; }
    if ($request_method = GET)      { set $getassets "${getassets}B"; }
    if ($getassets = "AB") {
        rewrite ^ $uri$args last;
    }

    location ~* ^(/plugins/(?!.*/static).*|^/pimcore/(?!(static|modules/3rdparty)).*|/website/var/(?!tmp|assets|areas)|^.*modules/.*/static.*|^(vendor|tests|node_modules|phing)/.*|^(bower|package|composer|gulpfile)\.) {
        return 403;
    }

    location / {
      try_files $uri $uri/ /index.php$args;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
    }

    location ~* \.(jpe?g|gif|png|bmp|ico|css|js|pdf|zip|htm|html|docx?|xlsx?|pptx?|txt|wav|swf|avi|mp\d)$ {
        access_log off;
        log_not_found off;
        try_files $uri $uri/ /website/var/assets$uri /index.php?$args;
        expires 1w;
    }

    location ~ /\.ht {
        deny all;
    }

    # cache-buster rule for scripts & stylesheets embedded using view helpers
    rewrite ^\/cache-buster-\d+(.*) $1 break;
}

Save and close the file, then activate the server block by creating a symbolic link:

sudo ln -s /etc/nginx/sites-available/pimcore.conf /etc/nginx/sites-enabled/

Nest the Nginx configuration and restart nginx service with the following command:

sudo nginx -t
sudo systemctl restart nginx

Access Pimcore

Before accessing the Pimcore Web Interface, you will need to allow HTTP service through UFW firewall.

By default UFW is disabled on your system, so you need to enable it first. You can enable it with the following command:

sudo ufw enable

Once UFW firewall is enabled, you can allow HTTP service by running the following command:

sudo ufw allow http

You can now check the status of UFW firewall by running the following command:

sudo ufw status

Finally, open your web browser and type the URL http://yourdomain.com/, you should see the following installation page :

HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/1205732684.png” alt=”” />

Provide your database username, password, database name, admin username and password. Then click on the Install Now button you should see the following page:

HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/1397309899.png” alt=”” />

Provide your admin username and password then click on the Login button, you will be redirect to the Pimcore default dashboard.

Congratulations! You have successfully installed Pimcore on your Ubuntu 16.04 server.

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Share this Article!

Related Posts

Node.js Authentication – A Complete Guide with Passport and JWT

Node.js Authentication – A Complete Guide with Passport and JWT

Truth be told, it’s difficult for a web application that doesn’t have some kind of identification, even if you don’t see it as a security measure in and of itself. The Internet is a kind of lawless land, and even on free services like Google’s, authentication ensures that abuses will be avoided or at least […]

Node.js and MongoDB: How to Connect MongoDB With Node

Node.js and MongoDB: How to Connect MongoDB With Node

MongoDB is a document-oriented NoSQL database, which was born in 2007 in California as a service to be used within a larger project, but which soon became an independent and open-source product. It stores documents in JSON, a format based on JavaScript and simpler than XML, but still with good expressiveness. It is the dominant […]

Using MySQL with Node.js: A Complete Tutorial

Using MySQL with Node.js: A Complete Tutorial

Although data persistence is almost always a fundamental element of applications, Node.js has no native integration with databases. Everything is delegated to third-party libraries to be included manually, in addition to the standard APIs. Although MongoDB and other non-relational databases are the most common choice with Node because if you need to scale an application, […]

Node.Js Vs Django: Which Is the Best for Your Project

Node.Js Vs Django: Which Is the Best for Your Project

Django and NodeJs are two powerful technologies for web development, both have great functionality, versatile applications, and a great user interface. Both are open source and can be used for free. But which one fits your project best? NodeJs is based on JavaScript, while Django is written in Python. These are two equally popular technologies […]

Nodejs Vs PHP:  Which Works Best?

Nodejs Vs PHP: Which Works Best?

Before getting into the “battle” between Node.js and PHP we need to understand why the issue is still ongoing. It all started with the increased demand for smartphone applications, their success forcing developers to adapt to new back-end technologies that could handle a multitude of simultaneous requests. JavaScript has always been identified as a client-side […]