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
Table of Contents
1. Login to your VPS via SSH with your sudo user
ssh user@vps_IP
2. Update the system and install necessary packages
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)]> FLUSH PRIVILEGES;
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:
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:
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: https://github.com/shopware/shopware/releases. At the time of writing, the latest version is Shopware version 5.1.6.
[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.
7 thoughts on “Install Shopware 5 on Ubuntu 16.04”
Hi,
Thank you very much !
There is a little mistake in your nginx config. “rewrite backend/media/(.*) /media/$1 last” should have a “;” at the end of the line.
Hi,
when trying this on Ubuntu Server 16.04 and 16.10.02 the Shop wouldnt start. In /var/log/nginx/shopware.error.log the following messages showed:
2017/03/25 12:16:00 [error] 52185#52185: *2 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1665 Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. in /home/andreas/myshopware.com/engine/Shopware/Components/Session/PdoSessionHandler.php:509
Stack trace:
#0 /home/andreas/myshopware.com/engine/Shopware/Components/Session/PdoSessionHandler.php(509): PDOStatement->execute()
#1 /home/andreas/myshopware.com/engine/Shopware/Components/Session/PdoSessionHandler.php(278): Shopware\Components\Session\PdoSessionHandler->doRead('a08f929b57ebf2f...')
#2 [internal function]: Shopware\Components\Session\PdoSessionHandler->read('a08f929b57ebf2f...')
#3 /home/andreas/myshopware.com/engine/Library/Zend/Session.php(491): session_start()
#4 /home/andreas/myshopware.com/engine/Shopware/Components/DependencyInjectio" while reading response header from upstream, client: 192.168.2.107, server: myshopware.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-andreas-fpm.sock:", host: "myshopware.com"
After changing /etc/mysql/my.cnf
#binlog_format=row
to
binlog_format=MIXED
and
service mysqld restart
the Shopware page startet to work.
Hi, after finishin this tutorial, I’m facing problems to load the page in my browser.
The nginx Server gets into a infinite redirect loop, where at some point the browser ends the request.
So the servers is constantly redirecting (HTTP 301) with this nginx config, can you help me with this issue?
Hi,
thanks for the Article. Maybe you should add “php-zip” to the installation, since the “composer install” process will need it – so it also can be used when you´re not building via ANT.
Hi,
Thank you very much !
There is a little mistake in your nginx config. “rewrite backend/media/(.*) /media/$1 last” should have a “;” at the end of the line.
Phil
Thanks Phil! We updated the post.
Hi,
when trying this on Ubuntu Server 16.04 and 16.10.02 the Shop wouldnt start. In /var/log/nginx/shopware.error.log the following messages showed:
2017/03/25 12:16:00 [error] 52185#52185: *2 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1665 Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. in /home/andreas/myshopware.com/engine/Shopware/Components/Session/PdoSessionHandler.php:509
Stack trace:
#0 /home/andreas/myshopware.com/engine/Shopware/Components/Session/PdoSessionHandler.php(509): PDOStatement->execute()
#1 /home/andreas/myshopware.com/engine/Shopware/Components/Session/PdoSessionHandler.php(278): Shopware\Components\Session\PdoSessionHandler->doRead('a08f929b57ebf2f...')
#2 [internal function]: Shopware\Components\Session\PdoSessionHandler->read('a08f929b57ebf2f...')
#3 /home/andreas/myshopware.com/engine/Library/Zend/Session.php(491): session_start()
#4 /home/andreas/myshopware.com/engine/Shopware/Components/DependencyInjectio" while reading response header from upstream, client: 192.168.2.107, server: myshopware.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-andreas-fpm.sock:", host: "myshopware.com"
After changing /etc/mysql/my.cnf
#binlog_format=row
to
binlog_format=MIXED
and
service mysqld restart
the Shopware page startet to work.
Best regards,
Andreas
Sorry, that was service mariadb restart, of course…
Hi, after finishin this tutorial, I’m facing problems to load the page in my browser.
The nginx Server gets into a infinite redirect loop, where at some point the browser ends the request.
So the servers is constantly redirecting (HTTP 301) with this nginx config, can you help me with this issue?
Thanks in Advance!
Best regards!
Hi Boris,
Please closely follow the tutorial and make all necessary changes to the nginx configuration file.
Hi,
thanks for the Article. Maybe you should add “php-zip” to the installation, since the “composer install” process will need it – so it also can be used when you´re not building via ANT.