How to Install Pimcore on Ubuntu 20.04

PIMCore is a free and open-source enterprise content management system written in PHP. It combines Product Information Management (PIM), Master Data Management (MDM), Digital Asset Management (DAM), a Customer Data Platform (CDP), and a Digital Experience Platform (DXP) in a single application, with web content management and print publishing built in.
This article explains how to install PIMCore on an Ubuntu 20.04 server. It covers installing Apache, PHP-FPM, and MySQL, creating the application database, deploying PIMCore with Composer, configuring an Apache virtual host, and reaching the administrator interface.
Prerequisites
Before you begin, you need to:
- Have access to an Ubuntu 20.04 server as a non-root user with sudo privileges.
- Update the installed packages on the server.
- Point a domain such as
example.comto your server's public IP address.
The stack this article installs meets the following minimum versions:
- Apache 2.4 or later
- PHP 8.0 or later
- MySQL 8.0 or later, or MariaDB 10.3 or later
Install the Required Packages
Ubuntu 20.04 does not ship PHP 8.0 in its default repositories, so the packages come from the ondrej/php repository. PHP-FPM handles the application requests while Apache serves the site and proxies PHP to that process pool.
Update the package list.
console$ sudo apt update
Install the tooling required to add a third-party repository.
console$ sudo apt -y install software-properties-common
Add the PHP repository.
console$ sudo add-apt-repository ppa:ondrej/php
Refresh the package list so that it includes the new repository.
console$ sudo apt update
Install Apache, MySQL, PHP, and the extensions PIMCore requires.
console$ sudo apt install apache2 mysql-server php8.0 libapache2-mod-php8.0 php8.0-mysql \ php8.0-curl php8.0-xml php8.0-zip php8.0-mbstring php8.0-intl php8.0-opcache \ php8.0-imagick php8.0-gd php8.0-cli php8.0-fpm libapache2-mod-fcgid wget unzip -y
Open the PHP-FPM configuration file.
console$ sudo nano /etc/php/8.0/fpm/php.ini
Find the following directives and set them to the values below.
inimemory_limit = 256M upload_max_filesize = 100M post_max_size = 100M
Save and close the file.
memory_limit: Raises the per-request memory ceiling, which PIMCore needs when building assets and running the installer.upload_max_filesizeandpost_max_size: Allow larger asset uploads through the administrator interface.
Enable the Apache modules that forward requests to PHP-FPM.
console$ sudo a2enmod proxy_fcgi setenvif
Enable the PHP-FPM configuration.
console$ sudo a2enconf php8.0-fpm
Restart Apache to apply the changes.
console$ sudo systemctl restart apache2
Create the PIMCore Database
PIMCore stores its content, asset metadata, and user accounts in MySQL. Securing the server first removes the anonymous accounts and test database that a default installation leaves in place.
Enable MySQL to start at boot.
console$ sudo systemctl enable mysql
Run the security script.
console$ sudo mysql_secure_installation
The script asks a series of questions. Answer them as follows:
- Setup VALIDATE PASSWORD plugin: Enter
n. - Remove anonymous users: Enter
y. - Disallow root login remotely: Enter
y. - Remove test database and access to it: Enter
y. - Reload privilege tables now: Enter
y.
- Setup VALIDATE PASSWORD plugin: Enter
Log in to the MySQL shell and enter your password when prompted.
console$ sudo mysql -u root -p
Create a database named
pimcore.sqlCREATE DATABASE pimcore charset=utf8mb4;
Create a database user. Replace
DB-PASSWORDwith a strong password.sqlCREATE USER 'pimcoreuser'@'localhost' IDENTIFIED BY 'DB-PASSWORD';
Grant the user full access to the database.
sqlGRANT ALL ON pimcore.* TO 'pimcoreuser'@'localhost' WITH GRANT OPTION;
Apply the privilege changes.
sqlFLUSH PRIVILEGES;
Exit the MySQL shell.
sqlexit;
Install PIMCore
Composer resolves the PIMCore packages and their dependencies into the web root. The COMPOSER_MEMORY_LIMIT variable removes the memory ceiling for this command, because resolving the dependency tree exceeds the default limit.
Install the packages Composer needs to fetch the project.
console$ sudo apt install curl git
Install Composer.
console$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Change to the web root.
console$ cd /var/www/
Create the project.
console$ sudo COMPOSER_MEMORY_LIMIT=-1 composer create-project pimcore/skeleton pimcore
Change to the installation directory.
console$ cd /var/www/pimcore
Run the installer. Enter the database credentials you created earlier and the administrator account you want to use.
console$ sudo ./vendor/bin/pimcore-install
Set the directory ownership to the web server user.
console$ sudo chown www-data:www-data -R /var/www/pimcore/
Set the directory permissions.
console$ sudo chmod -R 755 /var/www/pimcore/
Configure the Apache Virtual Host
Apache serves the application from the public directory rather than the project root, which keeps the configuration files and vendor directory outside the web root. The rewrite module is required because PIMCore routes every request through a front controller.
Allow HTTP traffic through the firewall.
console$ sudo ufw allow 80
Create the virtual host file.
console$ sudo nano /etc/apache2/sites-available/pimcore.conf
Add the following configuration. Replace
example.comwith your domain andadmin@example.comwith your email address.ini<VirtualHost *:80> ServerAdmin admin@example.com DocumentRoot /var/www/pimcore/public ServerName example.com <Directory /var/www/pimcore/public/> Options FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Save and close the file.
DocumentRoot: Points at thepublicdirectory so that only the front controller and assets are reachable.AllowOverride All: Lets the bundled.htaccessfile apply the rewrite rules that PIMCore requires.
Enable the rewrite module.
console$ sudo a2enmod rewrite
Enable the new virtual host.
console$ sudo a2ensite pimcore.conf
Disable the default virtual host.
console$ sudo a2dissite 000-default.conf
Restart Apache to apply the configuration.
console$ sudo systemctl restart apache2
Access the PIMCore Administrator Interface
The administrator interface is served from the /admin/ path on the domain you configured. Signing in confirms that Apache, PHP-FPM, and the database are all working together.
Open the administrator interface in a web browser. Replace
example.comwith your domain.http://example.com/admin/Sign in with the administrator account you created during the installation.
Conclusion
You have installed PIMCore on an Ubuntu 20.04 server with Apache, PHP-FPM, and MySQL, and reached the administrator interface through your own domain. Secure the site with a TLS certificate before exposing it publicly, and review the data model and asset settings in the administrator interface to start building your catalog. For more information, visit the official PIMCore documentation.