How to Install Shopware Community Edition on FreeBSD

In this tutorial, we will guide you through the installation of Shopware Community Edition on FreeBSD latest version. Shopware is an open-source eCommerce platform that provides a wide range of features, robustness and scalability.

Requirements

Before proceeding, you will need to make sure that your system meets the following requirements:

Step 1: Update the System

Before installing Shopware, make sure your system is up-to-date by running the following commands:

sudo pkg update

sudo pkg upgrade

Step 2: Install the Required Packages

To install the packages required by Shopware, execute the following command:

sudo pkg install php72 php72-curl php72-zip php72-mysqli php72-xml php72-gd php72-mbstring php72-bz2 php72-intl php72-pear php72-gettext php72-openssl mod_php72 mysql57-client apache24

Step 3: Configure the Database

Next, you need to choose the database server for Shopware. For this tutorial, we are going to use MySQL as our database server.

To install MySQL, run the following command:

sudo pkg install mysql57-server

After installing MySQL, start the database server and enable it to automatically start after a system reboot by executing the following commands:

sudo sysrc mysql_enable=YES

sudo service mysql-server start

Now, access the MySQL server prompt and create a new database for Shopware:

sudo mysql -u root -p

mysql> CREATE DATABASE shopwaredb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

mysql> GRANT ALL ON shopwaredb.* TO 'shopwareuser'@'localhost' IDENTIFIED BY 'yourpassword';

mysql> FLUSH PRIVILEGES;

mysql> EXIT;

Step 4: Download and Install Shopware

Next, download the latest version of Shopware into your web server's root directory. You can either download it from the official website or use the following command to download it directly from the terminal:

sudo fetch https://www.shopware.com/de/Download/redirect/version/sw6/file/install-v6.4.3.0.zip -o /usr/local/www/shopware.zip

After downloading, unzip the package and move it to the web server root directory:

sudo unzip /usr/local/www/shopware.zip -d /usr/local/www/

sudo mv /usr/local/www/install /usr/local/www/shopware

Now, you need to set the correct permissions for the Shopware directory by executing the following commands:

sudo chown -R www:www /usr/local/www/shopware

sudo chmod -R 755 /usr/local/www/shopware/

Step 5: Configure the Web Server

The next step is to configure the web server to make it accessible for Shopware.

If you are using Apache, create a new virtual host configuration file by executing the following command:

sudo nano /usr/local/etc/apache24/Includes/shopware.conf

Copy and paste the following content into the file:

<VirtualHost *:80>
   ServerAdmin admin@example.com
   DocumentRoot /usr/local/www/shopware/public
   ServerName yourdomain.com
   ErrorLog /var/log/httpd/shopware-error.log 
   CustomLog /var/log/httpd/shopware-access.log combined
   <Directory /usr/local/www/shopware/public/>
       Options Indexes FollowSymLinks MultiViews
       AllowOverride All
       Order allow,deny
       allow from all
   </Directory>
</VirtualHost> 

Save and exit the file.

If you are using Nginx, create a new server block configuration file by executing the following command:

sudo nano /usr/local/etc/nginx/shopware.conf

Copy and paste the following content into the file:

server {
   listen 80;
   server_name yourdomain.com;
   root /usr/local/www/shopware/public;
   index index.php;
   access_log /var/log/nginx/shopware-access.log;
   error_log /var/log/nginx/shopware-error.log;
   location / {
       try_files $uri $uri/ /index.php$is_args$args;
   }
   location ~ \.php$ {
       include fastcgi_params;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       fastcgi_pass unix:/var/run/php-fpm.sock;
       fastcgi_index index.php;
   }
}

Again, save and exit the file.

Finally, restart the web server to apply the changes:

sudo service apache24 restart

OR

sudo service nginx restart

Step 6: Finish the Installation through the Browser

Now, navigate to your web server's IP address or domain name to finish the Shopware installation.

Follow the instructions to complete the installation. When prompted for the database details, provide the following information:

Once the installation is complete, remove the “install” directory from the Shopware directory:

sudo rm -rf /usr/local/www/shopware/install/

Congratulations! You have successfully installed Shopware Community Edition on FreeBSD. You can now start configuring and using the eCommerce platform to run your online store.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!