How to Install Shopware CE on Debian 9

In this tutorial, we will show you how to install Shopware CE on a Debian 9 VPS. Shopware is easy-to-install and set up, making it a quick installation. The tutorial will go over the required prerequisites, the installation of Shopware, as well as the configuration of Shopware itself.

Install Shopware CE on Debian 9Shopware Community Edition (CE) is a free and open-source e-commerce application. As an alternative to another e-commerce application, like Magento, Shopware is a complete e-commerce solution – it is a very powerful and flexible application. Shopware is very easy-to-use, and you don’t need to master PHP in order to use it. The application is based on a number of symphony framework components developed in PhpStorm through the core features and its plugins.

Requirements:

  • For the purposes of this tutorial, we will be using a Debian 9 Server.
  • You will also need a working LAMP or LEMP (Linux, Apache/Nginx, MySQL, PHP) stack. The tutorial will go over installing this if you do not currently have a stack set up.
  • Full SSH root access or a user with sudo privileges is also required.

Step 1: Connect to Your Server

Before we begin, you will need to connect to your server via SSH as the root user or as any other user that has sudo privileges.

To connect to your server as the root user, use the following command:

ssh [email protected]IP_ADDRESS -p PORT_NUMBER

Make sure to replace IP_ADDRESS and PORT_NUMBER with your actual server IP address and SSH port number.

Once logged in, make sure that your server is up-to-date by running the following commands:

sudo apt-get update
sudo apt-get upgrade

Step 2: Install Apache

To install Apache on your server, run the following command:

sudo apt-get install apache2

Once the installation is complete, enable the Apache service to start automatically upon system boot. You can do that with the following command:

sudo systemctl enable apache2

To verify that Apache is running, execute the following command:

sudo systemctl status apache2

Output:

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2019-04-16 13:07:06 EDT; 8min ago
 Main PID: 25857 (apache2)
    Tasks: 7 (limit: 4915)
   CGroup: /system.slice/apache2.service
           ├─25857 /usr/sbin/apache2 -k start
           ├─25860 /usr/sbin/apache2 -k start
           ├─25861 /usr/sbin/apache2 -k start
           ├─25862 /usr/sbin/apache2 -k start
           ├─25863 /usr/sbin/apache2 -k start
           ├─25864 /usr/sbin/apache2 -k start
           └─30994 /usr/sbin/apache2 -k start

Step 3: Install MariaDB

The next step is to install the MariaDB database server.

To install MariaDB on your system, type the following command and enter the character ‘Y’ when prompted:

sudo apt-get install mariadb-server

During the installation, you will be asked to enter a password for the MariaDB root user. Make sure to enter a strong password.

To further improve the security of our MariaDB installation as well as set up a password for our MariaDB root user, we need to run the mysql_secure_installation script and follow the on-screen instructions. Run the command below to configure your system:

sudo mysql_secure_installation

If the program asks you to enter your current MariaDB root password, just press your [Enter] key once, as no password is set by default when installing MariaDB.

A few more questions will be displayed on-screen – it is recommended that you answer yes to all of them by entering the character ‘Y’:

Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y

Again, we can enable MariaDB to start on boot with the following command:

sudo systemctl enable mariadb

That’s it – MariaDB has been installed and made more secure.

Step 4: Install PHP

The last step of our LAMP stack setup is to install PHP. Debian 9 comes with PHP 7.0 by default.

We will also include some additional modules in order to help PHP connect to our Apache and database servers. On top of these, we will also install modules that are required by Shopware CE.

To do this, type the following command:

apt-get install php7.0 php7.0-cli php7.0-common php7.0-mysql php7.0-curl php7.0-json php7.0-zip php7.0-gd php7.0-xml php7.0-mbstring php7.0-opcache

Step 5: Install Shopware CE

Now that we have a LAMP stack set up, we can now start with our Shopware CE installation and configuration.

First, let’s make a new directory for our Shopware installation:

mkdir /var/www/shopware

Let’s download the latest stable Shopware CE version from this link into our new directory. You can do this with the following commands:

cd /var/www/shopware
wget https://releases.shopware.com/install_5.5.7_f785facc70e39f2ca4292e78739457417f19fbcf.zip?_ga=2.110917381.1678735926.1552879434-1860898197.1552787146 -O shopware.zip

To extract the file, execute the following command:

sudo unzip shopware.zip

The owner of these files needs to be the user of the web server running on your system. In our example, we are using the Apache web server and Apache runs under the “www-data” user on Debian.  To change the owner and set the correct permissions for these files, you need to run the following command:

sudo chown -R www-data:www-data /var/www/shopware/

Step 6: Configure the Database

Next, we need to create a new database. To do this, log in to your MariaDB database server as the root user by typing the following command:

sudo mariadb -u root -p

Then enter the password you made for your MariaDB user. Once you are signed in, create a new database and user by running the following commands on the MariaDB shell:

CREATE DATABASE shopware;
CREATE USER shopware@localhost IDENTIFIED BY 'strong-password';
GRANT ALL PRIVILEGES ON shopware.* TO shopware@localhost;
FLUSH PRIVILEGES;

Make sure to replace strong-password with an actual strong password.

To exit the MariaDB database server command line, type:

exit

Step 7: Configure Apache

In this step, we will show you how to create a virtual host file for Apache – this is so you can access your Shopware using your domain name.

Create the virtual host file by executing the following command:

nano /etc/apache2/sites-available/shopware.conf

And enter the following information:

<VirtualHost *:80>
     DocumentRoot /var/www/shopware
     ServerName mydomain.com <Directory /var/www/shopware/> Options FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/shopware_error.log CustomLog ${APACHE_LOG_DIR}/shopware_access.log combined </VirtualHost>

In our example, we will use a domain called mydomain.com. Make sure to replace mydomain.com with your actual domain/subdomain name that you would like to use for your Shopware.

To enable the new Shopware virtual host, run the following command:

sudo a2ensite shopware.conf

You should see the following output:

Enabling site shopware.

You also need to enable the Apache mod_rewrite module. You can do this with the following command:

sudo a2enmod rewrite

Reload your Apache server in order to activate the new configuration:

sudo systemctl reload apache2

Step 8: Installing Shopware CE

You can now navigate to http://mydomain.com in your favorite browser to start the Shopware CE installation wizard.

Choose your language and click “Next”. On the next few pages, you can check if your server meets all the system requirements, read and accept the terms of service, and connect your Shopware software with the database that we created earlier:

You can then start the Shopware installation:

 

After the installation has completed, you will be asked whether you want to use the free Community Edition or purchase a Shopware license (Professional, Professional Plus or Enterprise). Select the Community Edition option and click on Next.

On the next page, you will need to enter some basic information about your shop, such as name, email address, language and the name and password of your admin account:

Once this is done, Shopware has been successfully installed on your system.

You can now access your admin panel and login with your admin account at http://mydomain.com/backend

That’s it! Shopware CE has been successfully installed on your Debian 9 server.


Install Shopware CE on a Debian 9 VPSOf course, you don’t have to know how to install Shopware CE on Debian 9 if you have Managed Debian 9 Hosting with us. You can simply ask our support team to install Shopware CE on Debian 9 for you. They are available 24/7, and will be able to help you with the installation of Shopware CE on Debian 9.

PS. If you enjoyed reading this blog post on how to install Shopware CE on Debian 9, feel free to share it on social networks by using the shortcuts below, or simply leave a comment in the comments section. Thank you.