Install Pimcore 10 on Ubuntu 20.04

Pimcore is a fully integrated software stack for CMS, DAM, PIM, and Commerce that is the leading open source platform for managing digital data.

Pimcore CMS is a web-based content management system written in PHP that uses MariaDB as its database. As a result, you’ll need to set up latest Nginx, PHP, and MariaDB on your machine.

  1. Install Nginx Server and start the server
sudo apt-get install nginx
sudo systemctl start nginx
sudo systemctl enable nginx

2. Install latest MariDB and start the server

Add MariaDB 10.4 Repository

$ sudo apt install software-properties-common
$ sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
$ sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.rackspace.com/mariadb/repo/10.4/ubuntu focal main'

Run System Update and Install MariaDB 10.4

$ sudo apt update
$ sudo apt install mariadb-server

Start MariaDB Service and set root password

$ systemctl start mariadb
$ systemctl enable mariadb.service

$ mysql_secure_installation

3. Install PHP 8.0 on the server

Add the Ondrej Sury PPA Repository

sudo add-apt-repository ppa:ondrej/php

Next, update the system repositories

sudo apt update

Install PHP 8.0 with all PHP extensions required to run PIMCORE

apt install php8.0 php8.0-fpm  php8.0-gd php8.0-mysqlnd php8.0-pdo php8.0-iconv php8.0-dom php8.0-simplexml php8.0-gd php8.0-exif php8.0-mbstring php8.0-zlib php8.0-zip php8.0-intl php8.0-opcache php8.0-curl php8.0 php8.0-cli php8.0-zip php8.0-json

Start PHP-FPM and enable it

systemctl start php8.0-fpm
systemctl enable php8.0-fpm

Add below values to php.ini for PIMCORE installation

file_uploads = On
allow_url_fopen = On
memory_limit = 512M
upload_max_filesize = 200M
post_max_size = 250M
max_execution_time = 300
cgi.fix_pathinfo = 0

Next, install COMPOSER latest for PIMCORE

$ sudo apt update
$ curl -sS https://getcomposer.org/installer -o composer-setup.php
$ sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

Now, create database for PIMCORE

mysql -u root -p
Enter Password:

MariaDB [(none)]> CREATE DATABASE pimcoredb;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON pimcoredb.* TO 'pimcoreuser'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT

Install PIMCORE

Pimcore needs to be installed on your root directory where your domain is pointed in Nginx conf.

For Skeleton Package to be installed

cd /var/www/pimcore
COMPOSER_MEMORY_LIMIT=-1 composer create-project pimcore/skeleton my-project

For Demo Package to be installed

cd /var/www/pimcore
COMPOSER_MEMORY_LIMIT=-1 composer create-project pimcore/demo my-project

Point the document root of your domain in Nginx conf to the newly created /public folder inside my-project folder.

An example Nginx conf is added below.

upstream php-pimcore10 {
    server unix:/var/run/php/pimcore.sock;
}

server {
    listen 80;
    listen [::]:80;

    server_name example.com;

    root /var/www/pimcore/my-project/public;

    location ~* /\.well-known/ {
      try_files $uri /;
    }
       return 301 https://$host$request_uri;
    } 
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name example.com;

    root /var/www/pimcore/my-project/public;
    index index.php;

    
    ssl_certificate   path to SSL cert;
    ssl_certificate_key path to SSL key;
    ssl_session_timeout 1d;
    ssl_session_cache shared:MozSSL:10m;  # about 40000 sessions
    ssl_session_tickets off;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
    ssl_prefer_server_ciphers off;

    # HSTS (ngx_http_headers_module is required) (63072000 seconds)
    add_header Strict-Transport-Security "max-age=63072000" always;

    # OCSP stapling
    ssl_stapling on;
    ssl_stapling_verify on;
    server_tokens off;
    add_header Content-Security-Policy "default-src 'self';" always;
    add_header Referrer-Policy same-origin;
    add_header Feature-Policy "geolocation 'none';midi 'none';sync-xhr 'none';microphone 'none';camera 'none';magnetometer 'none';gyroscope 'none';fullscreen 'self';payment 'none';";
    add_header Permissions-Policy "geolocation=(), midi=(), sync-xhr=(), microphone=(), camera=(), magnetometer=(), gyroscope=(), fullscreen=(self), payment=()";
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header X-Xss-Protection "1; mode=block" always;
    add_header X-Content-Type-Options "nosniff" always;
    client_max_body_size 100m;
    access_log  /var/log/access.log;
    error_log   /var/log/error.log error;
    rewrite ^/cache-buster-(?:\d+)/(.*) /$1 last;

    location ~* /var/assets/.*\.php(/|$) {
        return 404;
    }
    location ~* /\.(?!well-known/) {
        deny all;
        log_not_found off;
        access_log off;
    }
    location ~* (?:\.(?:bak|conf(ig)?|dist|fla|in[ci]|log|psd|sh|sql|sw[op])|~)$ {
        deny all;
    }
    location ~* ^/admin/(adminer|external) {
        rewrite .* /index.php$is_args$args last;
    }
    location ~* .*/(image|video)-thumb__\d+__.* {
        try_files /var/tmp/thumbnails$uri /index.php;
        expires 2w;
        access_log off;
        add_header Cache-Control "public";
    }
    location ~* ^(?!/admin)(.+?)\.((?:css|js)(?:\.map)?|jpe?g|gif|png|svgz?|eps|exe|gz|zip|mp\d|ogg|ogv|webm|pdf|docx?|xlsx?|pptx?)$ {
        try_files /var/assets$uri $uri =404;
        expires 2w;
        access_log off;
        log_not_found off;
        add_header Cache-Control "public";
    }
    location / {
        error_page 404 /meta/404;
        try_files $uri /index.php$is_args$args;
    }
    location ~ ^/index\.php(/|$) {
        send_timeout 1800;
        fastcgi_read_timeout 1800;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        try_files $fastcgi_script_name =404;
        set $path_info $fastcgi_path_info;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_pass php-pimcore10;
    }
}

Run the Installer now

cd /var/www/pimcore/my-project/public
./vendor/bin/pimcore-install

The installation will ask you for Admin Details and Database Details. Provide them and Pimcore will install Successfully.

You can access your admin area using the below URL

https://example.com/admin
pimcore installation

If you are facing any issues during the pimcore installation or need the entire setup to be done within 1 to 2 hours, our server experts are available all the time.

FREE SERVER AUDITING

Get Auditing Report of Your Server for FREE!!

Fix this issue for

$25/Hour

$6.25/Hour

Applicable only to the first hour.