In this tutorial, we will show you how to install Bagisto on Ubuntu 20.04 LTS. For those of you who didn’t know, Bagisto is a free, eCommerce platform built Laravel eCommerce framework for anyone who wants to run an online store. Bagisto has a built-in easily navigable admin panel and is bundled with functionalities like Multi-Currency, Multi-Localization, Access Control Level, Multi-Channel, Payment integration, and much more.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the Bagisto eCommerce platform on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
Prerequisites
- A server running one of the following operating systems: Ubuntu 20.04, 18.04, and any other Debian-based distribution like Linux Mint.
- It’s recommended that you use a fresh OS install to prevent any potential issues
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, you can harm your system if you’re not careful when acting as the root.
Install Bagisto on Ubuntu 20.04 LTS Focal Fossa
Step 1. First, make sure that all your system packages are up-to-date by running the following apt
commands in the terminal.
sudo apt update sudo apt upgrade
Step 2. Installing the LAMP stack.
A Ubuntu 20.04 LAMP server is required. If you do not have LAMP installed, you can follow our guide here.
Step 3. Installing Node.js and Composer.
Bagisto requires Node.Js. To install Node.js on Ubuntu from its LTS repository, run the commands below to install:
curl -sL https://deb.nodesource.com/setup_14.x | bash - sudo apt install nodejs
Verify the Node.js version using the following command:
node -v
Next, install the Composer for managing PHP dependencies. You can install it with the following command below:
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
Step 4. Installing Bagisto on Ubuntu 20.04.
Now we run the commands below to download the latest version of Bagisto from GitHub:
wget https://github.com/bagisto/bagisto/archive/refs/tags/v1.3.2.zip unzip v1.3.1.zip mv bagisto-1.3.1 /var/www/html/bagisto
Next, navigate to the Bagisto directory and install the PHP dependencies:
cd /var/www/html/bagisto composer install
We will need to change some folder permissions:
chown -R www-data:www-data /var/www/html/bagisto/
Step 5. Configuring MariaDB.
By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation
script. you should read below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:
mysql_secure_installation
Configure it like this:
- Set root password? [Y/n] y - Remove anonymous users? [Y/n] y - Disallow root login remotely? [Y/n] y - Remove test database and access to it? [Y/n] y - Reload privilege tables now? [Y/n] y
Next, we will need to log in to the MariaDB console and create a database for the Bagisto. Run the following command:
mysql -u root -p
This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for Bagisto installation:
MariaDB [(none)]> CREATE DATABASE bagistodb; MariaDB [(none)]> CREATE USER 'bagistouser'@'localhost' IDENTIFIED BY 'your-strong-passwd'; MariaDB [(none)]> GRANT ALL ON bagistodb.* TO 'bagistouser'@'localhost' WITH GRANT OPTION; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> EXIT;
Step 6. Configuring Apache webserver.
Now create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘bagisto.conf
’ on your virtual server:
touch /etc/apache2/sites-available/bagisto.conf ln -s /etc/apache2/sites-available/bagisto.conf /etc/apache2/sites-enabled/bagisto.conf nano /etc/apache2/sites-available/bagisto.conf
Add the following lines:
<VirtualHost *:80> ServerAdmi admin@your-domain.com DocumentRoot /var/www/html/bagisto/public ServerName bagisto.your-domain.com <Directory /var/www/html/bagisto/public/> Options FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Now, we can restart the Apache webserver so that the changes take place:
sudo a2enmod rewrite sudo a2ensite bagisto.conf sudo systemctl restart apache2
Step 7. Set up HTTPS.
We should enable a secure HTTPS connection on Bagisto. We can obtain a free TLS certificate from Let’s Encrypt. Install the Let’s Encrypt client (Certbot) from the Ubuntu 20.04 repository:
sudo apt install certbot python3-certbot-apache
Next, run the following command to obtain a free TLS certificate using the Apache plugin:
sudo certbot --apache --agree-tos --redirect --staple-ocsp --email you@example.com -d example.com
If the test is successful, reload Apache for the change to take effect:
sudo apache2ctl -t sudo systemctl reload apache2
Step 8. Accessing Bagisto Web Interface.
Once successfully installed, open your web browser and access the Bagisto web UI using the URL https://bagisto.your-domain.com
. You should see the following screen:
Congratulations! You have successfully installed Bagisto. Thanks for using this tutorial for installing the Bagisto eCommerce platform on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you check the official Bagisto website.