Install Shopware 5 on Ubuntu 16.04

We’ll show you. how to install Shopware 5 on Ubuntu 16.04, with MariaDB, PHP-FPM and Nginx. Shopware is a modern open source e-commerce software, written in PHP on top of Symfony and Zend components. This guide should work on other Linux VPS systems as well but was tested and wrote this for an Ubuntu 16.04 VPS. Install Shopware 5 on Ubuntu 16.04

1. Login to your VPS via SSH with your sudo user

ssh [email protected]_IP

2. Update the system and install necessary packages

[user]$ sudo apt-get update && sudo apt-get -y upgrade
[user]$ sudo apt-get install software-properties-common nano wget ant

3. Install MariaDB 10.1

To add the MariaDB repository to your sources list and install the latest MariaDB 10.1 server, run the following commands:

[user]$ sudo apt-key adv --recv-keys --keyserver hkp:// 0xF1656F24C74CD1D8
[user]$ sudo add-apt-repository 'deb [arch=amd64,i386] xenial main'
[user]$ sudo apt-get update
[user]$ sudo apt-get install -y mariadb-server

When the installation is complete, run the following command to secure your installation:

[user]$ mysql_secure_installation

Next, we need to create a database for the Shopware installation.

[user]$ mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE shopware;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON shopware.* TO 'shopware'@'localhost' IDENTIFIED BY 'strong_password';
MariaDB [(none)]> \q

4. Install PHP and required PHP modules

To install the latest stable version of PHP version 7.0 and all necessary modules, run:

[user]$ sudo apt-get -y install php-fpm php-cli php-json php-curl php-gd php-mysql php-xml php-mbstring

The following commands will set the PHP memory limit to 512MB, change the values of upload_max_filesize and post_max_size to 100M and set the timezone to UTC.

sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.0/cli/php.ini
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.0/cli/php.ini
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/7.0/fpm/php.ini
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/7.0/fpm/php.ini
sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/7.0/fpm/php.ini

Create a new PHP-FPM pool for your user if you already don’t have one:

[user]$ sudo nano /etc/php/7.0/fpm/pool.d/your_user_name.conf
user = your_user_name
group = your_user_name
listen = /var/run/php/php7.0-your_user_name-fpm.sock
listen.owner = your_user_name = your_user_name
listen.mode = 0666
pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 10s
pm.max_requests = 200
chdir = /

Do not forget to change your_user_name with your username.
Restart PHP-FPM:

[user]$ sudo service php7.0-fpm restart

5. Download and Install Shopware

Download the latest version of Shopware from GitHub: At the time of writing, the latest version is Shopware version 5.1.6.

[user]$ wget
[user]$ unzip
[user]$ mv shopware-5.1.6 ~/
[user]$ rm -f

Set up the configuration and database connection:

[user]$ cd ~/
[user]$ ant configure
[user]$ ant build-unit

Download the test images:

[user]$ cd ~/
[user]$ wget
[user]$ unzip

6. Install and configure Nginx

To install the latest stable version of Nginx available on the Ubuntu repositories, run:

[user]$ sudo apt-get install nginx

Generate a self signed ssl certificate:

[user]$ sudo mkdir -p /etc/nginx/ssl
[user]$ cd /etc/nginx/ssl
[user]$ sudo openssl genrsa -des3 -passout pass:x -out shopware.pass.key 2048
[user]$ sudo openssl rsa -passin pass:x -in shopware.pass.key -out shopware.key
[user]$ sudo rm shopware.pass.key
[user]$ sudo openssl req -new -key shopware.key -out shopware.csr
[user]$ sudo openssl x509 -req -days 365 -in shopware.csr -signkey shopware.key -out shopware.crt

If you don’t want to get warnings associated with self-signed SSL Certificates, you can purchase a trusted SSL certificate here.

Next, create a new Nginx server block:

[user]$ sudo nano /etc/nginx/sites-available/
server {
    listen 443;
    root /home/your_user_name/;

    index shopware.php index.php;

    location / {
      rewrite files/documents/.* /engine last;
      rewrite backend/media/(.*) /media/$1 last;

      try_files $uri $uri/ /shopware.php$args;

    ssl on;
    ssl_certificate     /etc/nginx/ssl/shopware.crt;
    ssl_certificate_key /etc/nginx/ssl/shopware.key;
    ssl_session_timeout 5m;
    ssl_ciphers               'AES128+EECDH:AES128+EDH:!aNULL';
    ssl_protocols              TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

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

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.0-your_user_name-fpm.sock;
        fastcgi_index shopware.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 ~ /\.ht {
        deny all;

server {
    listen      80;

    add_header Strict-Transport-Security max-age=2592000;
    rewrite ^ https://$server_name$request_uri? permanent;

Do not forget to change your_user_name with your username.

Activate the server block by creating a symbolic link :

[user]$ sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/

7. Test and Restart the Nginx Web Server

Test the Nginx configuration and restart nginx:

[user]$ sudo nginx -t
[user]$ sudo service nginx restart

That’s it. You have successfully installed Shopware on Ubuntu 16.04. The default username and password are both demo. For more information about how to manage your Shopware installation, please refer to the official Shopware documentation.

Of course you don’t have to do any of this if you use one of our Optimized Ubuntu VPS Hosting services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, on how to Install Shopware 5 on Ubuntu 16.04,  please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.