11th February, 2017 | Tutorials |

How to Install Sylius eCommerce application on CentOS 7

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

Get a Cloud Server

Sylius is a free and open source e-commerce application. It is written in PHP using the Symfony framework and uses MySQL/MariaDB to store its data. It is fully customizable and has a full feature set for an online store. It also provides the API which can be used to develop mobile applications. The user interface for both store and administration panel is responsive and mobile ready. It supports almost all the payment providers and has plugin and themes for extending its features.

In this tutorial, we will learn to install Sylius on CentOS 7.


Sylius can be installed on systems with at least 1GB RAM. The requirement of RAM increase as the number of products and users increases. You will also need a minimal installation of CentOS 7 with root access on it. If you are logged in as a non-root user, you can run sudo -i to switch to root user.

Installing Sylius

Before installing any package it is recommended that you update the packages and repository using the following command.

yum -y update

Once you have your system updated, run the following command to install few packages on your server.

yum -y install httpd mariadb-server mariadb

The above command will install Apache web server with MariaDB database server. Now you will need to install PHP. Sylius supports both PHP 5.6 and 7. In this tutorial, we will learn to install both PHP 5.6 and 7.1. You must install only one version of PHP. The YUM repository contains PHP version 5.4 only, hence we will need to use the Webtatic repository to install a version of PHP 5.6 or 7.0. Run the following commands for installing EPEL repository as EPEL repository is required before we install Webtatic repository.

yum -y install epel-release yum -y update

Now install Webtatic repository using the following commands.

rpm -Uvh

To install PHP 5.6 and all the required PHP modules, run the following command.

yum -y install php56w php56w-cli php56w-curl php56w-gd php56w-exif php56w-fileinfo php56w-intl php56w-json php56w-ctype php56w-xml php56w-libxml php56w-mbstring php56w-iconv php56w-posix php56w-pdo php56w-mysqli php56w-opcache

To install PHP 7.1 and all the required PHP modules, run the following command.

yum -y install php71w php71w-cli php71w-curl php71w-gd php71w-exif php71w-fileinfo php71w-intl php71w-json php71w-ctype php71w-xml php71w-libxml php71w-mbstring php71w-iconv php71w-posix php71w-pdo php71w-mysqli php71w-opcache

Make sure that you are using only one of the PHP versions mentioned above. Once you have PHP installed, you can check the version of PHP using the following command.

php -v

You should get following output.

[root@liptan-pc ~]# php -v
PHP 7.1.1 (cli) (built: Jan 19 2017 20:35:16) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

Once PHP is installed, you will need to configure few things in your php.ini configuration. Open /etc/php.ini using your favorite editor.

nano /etc/php.ini

If you do not have nano installed, you can install it using yum -y install nano. Scroll down to find the following lines.

; Maximum amount of memory a script may consume (128MB)
memory_limit = 128M

You can increase the memory_limit to a higher amount so that the processing of PHP can also be done faster. Further find the following line,

; Defines the default timezone used by the date functions
;date.timezone = 

Change the timezone according to your country. Save the file and exit from the editor. You also will need to Enable Mod_rewrite by editing /etc/httpd/conf/httpd.conf using your favorite text editor.

nano /etc/httpd/conf/httpd.conf

Find the following line under <Directory "/var/www/html"> block.

AllowOverride None

Change it to AllowOverride All. Now install Composer using the following command. Composer is a dependency manager for PHP.

curl -sS | php mv composer.phar /usr/bin/composer

Now install the latest version of Node.js from the nodesource repository. Run the following command for same.

curl --silent --location | bash - yum -y install nodejs

To start the Apache web server and enable it to start at boot time, run the following command.

systemctl start httpd systemctl enable httpd

Start MariaDB and enable it to start at boot time using the following commands.

systemctl start mariadb systemctl enable mariadb

Now run the following command to secure your MariaDB installation.


It will run a small script which asks you to provide the root password for MariaDB. As we have just installed MariaDB, the root password is not set, just press enter to proceed further. It will ask you if you want to set a root password for your MariaDB installation, choose y and set a strong password for the installation. It will further ask you for removing test databases and anonymous users. Most of the questions are self-explanatory and you should answer yes or y to all the questions.

To create a database we will need to login to MySQL command line first. Run the following command for same.

mysql -u root -p

This will prompt you for the password, provide the root password of MySQL which you have set earlier. Now run the following query to create a new database for your Sylius installation.


The above query will create a database named sylius. For the database, you can use any name you prefer at the place of sylius. Make sure that you use semicolon at the end of each query as the query always ends with a semicolon. Once the database is created you can create a new user and grant all the permissions to the user for the database. To create a new database user, run the following query.

CREATE USER 'sylius_user'@'localhost' IDENTIFIED BY 'StrongPassword';

The above query will create a user with username sylius_user. You can use any preferred username instead of sylius_user. Replace StrongPassword with a strong password. Now provide the appropriate privileges to your database user over the database you have created. Run the following command.

GRANT ALL PRIVILEGES ON sylius.* TO 'sylius_user'@'localhost';

Now run the following command to immediately apply the changes on the database privileges.


Exit from MySQL prompt using exit command.

As we have all the dependencies ready, you can install Sylius using composer. Run the following command for same.

cd /var/www/html composer create-project -s beta sylius/sylius-standard sylius

The above command will take few minutes to download and install the PHP dependencies. Once the dependencies are installed, it will ask you to provide few parameter for parameters.yml file. In database_driver, provide mysqli. For database_host, enter For Port, enter the MySQL port number, which is 3306. Further, it will ask for database_name, enter the database name you have created earlier for Sylius. In our case, it is sylius_data. Further, it will you for database_userand database_password. You can use the database user you have created earlier. In our case database_user is sylius_user.

Next, it will ask for the SMTP server to use for sending out emails. Provide smtp for mailer_transport and your SMTP host in mailer_host. Finally provide the username or email and password of the SMTP server. If you think you have made any error then you can configure the parameters.yml using the following command.

cd /var/www/html/sylius nano app/config/parameters.yml

Once the parameters file is populated, you can install Sylius using the following command.

cd /var/www/html/sylius php bin/console sylius:install --env=prod --no-debug

The above command will first check for the all the required dependencies to install Sylius. If you have followed the tutorial correctly, you won't get any error or warnings. It will then install the Sylius application for the production environment. It will also write the database. Further, it will ask you if you want to load the sample data. For production environment you would not want to use the sample data, choose y or N accordingly. Now it will ask you the default shop currency, provide the currency in 3 letter ISO format, eg GBP. Provide the email address and password for the site administrator. Sylius is now installed on your server.

Furthermore, you will need to install a few more Node.js dependencies. Run the following commands to do so.

npm install npm run gulp

Now you will need to create a virtual host file. Run the following command to do so.

nano /etc/httpd/conf.d/ Replace with your actual domain. Now copy and paste the following lines into the file.
<VirtualHost *:80>
    DocumentRoot /var/www/html/sylius/web

<Directory /var/www/html/sylius/web> Options FollowSymLinks AllowOverride All Order allow,deny allow from all RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ app.php [QSA,L] </Directory>

ErrorLog /var/log/httpd/ CustomLog /var/log/httpd/ common


In the above configuration change to your actual domain. Once done, you will have to restart your Apache server so that the changes made can take effect.

systemctl restart httpd

Now you will need to disable your SELinux because Sylius does not work with SELinux policies. To temporary disable SELinux without restarting the server, run the following command.

setenforce 0

To completely disable the SELinux you will need to edit /etc/selinux/config file.

nano /etc/selinux/config

If you don't have nano installed, you can install it using yum -y install nano Find the following line:


Change it to:


Now you will need to reboot your server so that the new configuration can take effect.

You will also need to provide appropriate ownership of the files to Apache user using the following command.

chown -R apache:apache /var/www/html/sylius/web

You can now browse the following URL in your favorite browser.

You will see the following shop screen.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/997110838.png" alt="" />

You can login to the administrator panel by going to the following link.

Log in using the credentials provided during installation. You will see the administrator dashboard as shown below.

HP_NO_IMG/data/uploads/users/e840080c-7322-4497-85c0-150182bd4c02/504317591.png" alt="" />


In this tutorial, we have learned how to install Sylius e-commerce application on CentOS 7. You can now deploy the application on your server to create an online shop for your business.

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

Get a Cloud Server