Bagisto is a free and open source e-commerce platform. It is based on various open source technologies such as Laravel (PHP framework) and Vue.js.
Bagisto enables merchants to start their own shopping cart system with a variety of fully controllable functions. Features include a multistore inventory system, order management, customer cart, product rating, wish list, theme, CMS pages, responsive, multiple currencies and more.
In this tutorial we will learn how to install Bagisto on Ubuntu 20.04.
Requirements for the installation of Bagisto
- Ubuntu 20.04 or 18.04 server with one user with sudo access
- Web server: Apache2 or Nginx
- Recommended RAM 3GB +
- PHP: 7.4+ with extensions:
- MYSQL 5.7+ or MariaDB 10.2+
- Node.js: 8.11+
- Composer 1.6+
Step 1: update your Ubuntu system
Open your terminal, run the update command to keep the Ubuntu system in sync with the repositories.
sudo apt update
Step 2: Install Apache for Bagisto
You can use Nginx, but in this tutorial we are going to use Apache which is one of the most popular web servers out there.
To install Apache2 on Ubuntu, type the following:
sudo apt install apache2
Enable Apache mode_rewrite module:
sudo a2enmod rewrite
Restart the Apache service:
sudo systemctl restart apache2
Enable the Apache service to restart on boot:
sudo systemctl enable apache2.service
Step 3: Install PHP and Extensions for Bagisto
The standard PHP version available on Ubuntu 20.04 is v7.4. This can change depending on when you perform this installation.
Run the following commands to install standard PHP and recommended extensions:
sudo apt install php php-common php-gmp php-curl php-soap php-bcmath php-intl php-mbstring php-xmlrpc php-mysql php-gd php-xml php-cli php-zip libapache2-mod-php
Now you need to tell Apache to use the installed version of PHP.
$ php -v $ sudo a2enmod php7.4
Make the following changes to the php.ini file for best performance.
$ sudo nano /etc/php/7.4/apache2/php.ini
file_uploads = On allow_url_fopen = On short_open_tag = On memory_limit = 256M upload_max_filesize = 100M max_execution_time = 360 date.timezone = America/Chicago
Step 4: Install Node.js and Composer
Ubuntu 20.04 comes with Node.js in its standard repository. You can just run the following command to install the stable version of Node.js
$ sudo apt install nodejs
You can also use the nodesource PPA to install the latest version of Node.js.
To install Composer on Ubuntu, run the following command:
$ apt install composer
Step 5: create a Bagisto user
Create a user who owns the application code. Here I am creating a user named ‘bagisto’. You can choose any name.
$ sudo adduser bagisto
This will bring up a password window for you to set the password. You can leave the remaining fields
Empty by simply pressing the enter key.
After creating a user, we switch to a new user.
$ su - bagisto
Step 6: Download Bagisto
Use Composer to download and build a bagisto project in the user’s home directory.
$ composer create-project bagisto/bagisto
This will create a directory called ‘bagisto’ in the / home / bagisto directory.
You can navigate to the following directory to confirm the index.php file.
$ cd bagisto/public $ ls
You can now exit the bagisto user shell.
$ exit
Step 7: Apache configuration for Bagisto
We will configure Apache to support the websites. So we have to switch back to the sudo user for
Configure Apache.
$ sudo vi /etc/apache2/sites-enabled/000-default.conf
Change the document root directory to:
DocumentRoot /home/bagisto/bagisto/public
Save it and exit afterwards.
Now open the envvars file and change the Apache user / group from ‘www-data’ to ‘bagisto’:
$ sudo vi /etc/apache2/envvars
export APACHE_RUN_USER=bagisto export APACHE_RUN_GROUP=bagisto
Add the following set of directives to the main Apache configuration.
$ sudo vi /etc/apache2/apache2.conf
Options FollowSymLinks AllowOverride All Require all granted
Save the file and exit.
Step 8: Install MYSQL and create a Bagisto database
You can use either MySQL or MariaDB to store Bagisto data. Here I am using the MySQL database.
Enter the following to install the MySQL server on Ubuntu:
$ sudo apt install mysql-server
Now log into MySQL, create a database, create a user and give the user the necessary permissions to access the database.
$ sudo mysql -u root -p mysql> create database bagisto; mysql> CREATE USER 'bagistouser'@'localhost'IDENTIFIED WITH mysql_native_password BY 'bagisto'; mysql> GRANT ALL ON bagisto.* TO 'bagistouser'@'localhost' WITH GRANT OPTION; mysql> SET GLOBAL log_bin_trust_function_creators = 1; mysql> flush privileges; mysql> exit
Step 9: Bagisto configuration
First, let’s create the bagisto configuration file. To do this, use the existing sample file and create a file named .env in the Bagisto root directory (/ home / bagisto / bagisto).
$ sudo cp .env.example .env $ sudo nano .env
The .env file contains the Bagisto version which is defined in the APP_VERSION variable. Here I install Bagisto 1.3.2 version.
Specify the MySQL database information in the .env file name as follows:
DB_DATABASE=bagisto DB_USERNAME=bagistouser DB_PASSWORD=bagisto
Save and exit the file.
Now start the Bagisto installation script:
$ sudo php artisan bagisto:install
..... ..... Discovered Package: laravel/ui Discovered Package: maatwebsite/excel Discovered Package: nesbot/carbon Discovered Package: nunomaduro/collision Discovered Package: prettus/l5-repository Discovered Package: tymon/jwt-auth Package manifest generated successfully. Generated optimized autoload files containing 9184 classes Congratulations! The installation has been finished and you can now use Bagisto. Go to http://localhost/admin and authenticate with: Email: admin@example.com Password: admin123 Cheers!
In the output you will see the email and password to log in.
Now run the following commands to set the permission for the Bagisto root directory
$ sudo chmod -R 755 /home/bagisto/bagisto $ sudo chown -R bagisto:bagisto /home/bagisto/bagisto $ sudo systemctl restart apache2
Then access the dashboard by clicking on the url “example.com/admin/” in the admin panel.
The admin login will open as in the picture below.
The standard admin dashboard looks like this.
/ admin / account Make sure to change the password.
You can now visit the Bagisto e-commerce website home page.
diploma
In this tutorial, you learned how to install Bagisto on an Ubuntu 20.04 LTS server. In short, you
E-commerce platform is ready to use. You can now continue with your online shop.