Shopware is an application that is used for marketing and creating online shops. It is written in PHP language and stores the information in MySQL database service.
It is available both as open source and commercial edition. Its advantage is that this software is platform-independent, which means that it can be installed on different operating systems such as Linux, Windows, MacOS, etc.
Installing Shopware on Debian 11 with the LAMP stack is a straightforward process that can take up to 30 minutes. Let’s get things done!
Table of Contents
Prerequisites
- A server with Debian 11 as OS
- User privileges: root or non-root user with sudo privileges
- A valid domain pointed to the server IP address
Step 1. Update the System
To update the system packages to their latest versions available, execute the following command:
sudo apt-get update -y && sudo apt-get upgrade -y
Step 2. Install LAMP Stack
First, we will install the Apache Web server.
sudo apt-get install apache2 -y
Once installed, start and enable the service.
sudo systemctl enable apache2 && sudo systemctl start apache2
Check if the service is up and running:
sudo systemctl status apache2
You should receive the following output:
root@host:~# sudo systemctl status apache2 ● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2023-04-21 17:19:44 CDT; 10h ago Docs: https://httpd.apache.org/docs/2.4/ Main PID: 506 (apache2) Tasks: 9 (limit: 4675) Memory: 24.5M CPU: 2.653s CGroup: /system.slice/apache2.service
Next, we will install PHP along with its extensions. To do that, first add the GPG key and the repo because, in the default repository of Debian 11, they do not exist. To do that, execute the following commands:
apt -y install lsb-release apt-transport-https ca-certificates wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list sudo apt-get update -y
Once the PHP key and repo are added, PHP can be installed with the command:
sudo apt-get install php8.1 php8.1-common php8.1-curl libapache2-mod-php php8.1-imap php8.1-redis php8.1-cli php8.1-snmp php8.1-xml php8.1-zip php8.1-mbstring php8.1-gd php8.1-xml php8.1-mysql php-mbstring php8.1-intl -y
After successful installation, check the PHP version:
php -v
You should get the following output:
root@host:~# php -v PHP 8.1.18 (cli) (built: Apr 14 2023 04:39:46) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.18, Copyright (c) Zend Technologies with Zend OPcache v8.1.18, Copyright (c), by Zend Technologies
Last is the MariaDB database service:
sudo apt-get install mariadb-server -y
Start and enable the mariadb.service with the following commands:
sudo systemctl start mariadb && sudo systemctl enable mariadb
Check the status of the mariadb.service
sudo systemctl status mariadb
You should receive the following output:
root@host:~# sudo systemctl status mariadb ● mariadb.service - MariaDB 10.5.18 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2023-04-22 04:19:14 CDT; 12s ago Docs: man:mariadbd(8) https://mariadb.com/kb/en/library/systemd/ Main PID: 22089 (mariadbd) Status: "Taking your SQL requests now..." Tasks: 18 (limit: 4675) Memory: 69.9M CPU: 606ms CGroup: /system.slice/mariadb.service └─22089 /usr/sbin/mariadbd
Step 3. Create a Shopware database and user
To create a Shopware database, the Shopware user and grant the permissions for that user to the database first log in to MySQL command line with the mysql command and execute the following lines of code one by one:
CREATE USER ‘shopware’@’localhost’ IDENTIFIED BY ‘YourStrongPasswordHere’; CREATE DATABASE shopware; GRANT ALL PRIVILEGES ON shopware.* TO ‘shopware’@’localhost’; FLUSH PRIVILEGES; EXIT;
Step 4. Install Shopware
First, we need to download the Shopware. We will download it in the default document root of the Apache web server:
cd /var/www/html wget https://releases.shopware.com/sw6/install_v6.4.20.1_1d0e1a2bb4c4e0395c390b0911efd19748b1d9d0.zip
Once downloaded, extract it with the following command:
unzip install_v6.4.20.1_1d0e1a2bb4c4e0395c390b0911efd19748b1d9d0.zip rm install_v6.4.20.1_1d0e1a2bb4c4e0395c390b0911efd19748b1d9d0.zip
Set the right folder and files permission:
chown -R www-data:www-data /var/www/html/ chmod -R 775 /var/www/html/
Step 5. Create Apache Virtual Host File
Go into the Apache directory and create a configuration file for the Showpare.
cd /etc/apache2/sites-available/ touch showpare.conf
Open the file, paste the following lines of code, save the file and close it.
<VirtualHost *:80> ServerName yourdomain.com DocumentRoot /var/www/html/public <Directory /var/www/html/public> AllowOverride All </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Enable the Apache configuration for Shopware and rewrite the module.
a2dissite 000-default.conf sudo a2enmod rewrite sudo a2ensite showpare.conf
Check the syntax:
apachectl -t
You should receive the following output:
root@vps:~# apachectl -t Syntax OK
If the syntax is OK, restartd the Apache service.
Step 6. Finish Shopware Installation
To finish the Shopware installation, access the link http://YourDomainName
You need to follow the pictures below in order you can finish the installation successfully.
In the next step about database configuration, you need to enter the values you created before in Step 3.
The installation will start:
On the configuration tab, you need to set up for shop name, administrator username, administrator login and password:
Once this is done, you will be redirected to the login page and admin dashboard.
Congratulations! You successfully installed and configured Shopware on Debian 11. If you find this setup difficult, you can contact our technical support, and our admins will help you with this. You just need to sign up for one of our NVMe VPS hosting plans and submit a support ticket. We are available 24/7.
If you liked this about installing Shopware on Debian 11, please share it with your friends on social networks or simply leave a reply below.