18.6 C
Jaipur
Sunday, November 28, 2021

How to Install Bagisto on Ubuntu 20.04

Must read

Bagisto is a free and open-source e-commerce platform. It is built on various open source technologies such Laravel (PHP framework) and Vue.js.

Bagisto enables merchants to launch their own shopping cart system with a wide variety of fully controllable features. Its features include multistore inventory system, orders management, customer cart, product review, wishlist, theme, CMS pages, responsive, multiple currencies, and more.

In this tutorial, we learn how to install Bagisto on Ubuntu 20.04.

Requirements to install Bagisto

  • Ubuntu 20.04 or 18.04 server with a user with sudo access
  • Webserver: 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, however in this tutorial we are using Apache which is one of the popular webservers.

To install Apache2 on Ubuntu, type:

 sudo apt install apache2

Enable apache mode_rewrite module:

sudo a2enmod rewrite

Restart the apache service:

sudo systemctl restart apache2

Enable apache service to restart at boot:

sudo systemctl enable apache2.service

Step 3: Install PHP and extensions for Bagisto

The default PHP version available on Ubuntu 20.04 is v7.4. This may change depending on when you are performing this installation.

Run the following commands to install default 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 default repository. You can simply run the following command to install the stable version of Node.js

$ sudo apt install nodejs

You may 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 will be the owner of the application code. Here I am creating a user named ‘bagisto’. You can pick any name you want.

$ sudo adduser bagisto

This prompts a password window where you can set the password. The remaining fields can be left
empty by simply pressing the enter key.

After creating a user, we will switch to a new user.

$ su - bagisto

Step 6: Download Bagisto

Use composer to download and create bagisto project into the user home directory.

$ composer create-project bagisto/bagisto

This will create a directory named ‘bagisto’ in /home/bagisto directory.

You can navigate to the following directory to confirm the index.php file.

$ cd bagisto/public
$ ls

You can now exit from bagisto user shell.

$ exit

Step 7: Apache configuration for Bagisto

To support the web pages we will configure apache. So, we need to switch back to the sudo user for
configuring Apache.

$ sudo vi /etc/apache2/sites-enabled/000-default.conf

Change the document root to:

DocumentRoot /home/bagisto/bagisto/public

Save it, and exit after this.

Now open the envvars file and change apache user/group to ‘bagisto’ from ‘www-data’:

$ sudo vi /etc/apache2/envvars
export APACHE_RUN_USER=bagisto
export APACHE_RUN_GROUP=bagisto

In the main Apache configuration enclose the following group of directives.

$ sudo vi /etc/apache2/apache2.conf
 <Directory /home/bagisto/bagisto/public/>
 Options FollowSymLinks
  AllowOverride All
 Require all granted
 <Directory> 

Save the file and exit it.

Step 8: Install MYSQL and Create a Bagisto Database

You can either use MySQL or MariaDB to store Bagisto data. Here I will use the MySQL database.

To install MySQL server on Ubuntu, type:

$ sudo apt install mysql-server

Now login to MySQL, create a database, create a user and grant required permissions for the user 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

Let’s first create the bagisto configuration file. For that 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, defined in the variable APP_VERSION. Here I am installing Bagisto 1.3.2 version.

Provide the mysql database information in the .env filename 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: [email protected]
Password: admin123
Cheers!

You can see from the output the email and password to log in.

Now run the below commands to set the permission on Bagisto root directory

$ sudo chmod -R 755 /home/bagisto/bagisto
$ sudo chown -R bagisto:bagisto /home/bagisto/bagisto
$ sudo systemctl restart apache2

After that access, the dashboard by hitting the URL “example.com/admin/” in the Admin panel,
the admin login will open as in the image below.

bagisto login page

The default admin dashboard looks like.

Bagisto dashboard

<domain.com>/admin/account make sure to change password.

Now you can visit the home page of Bagisto e-commerce website.

Bagisto home page

Conclusion

In this tutorial, you learned how to install Bagisto on an Ubuntu 20.04 LTS server. In short, your
e-commerce platform is ready to use. You may now proceed with your online store.

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -

Latest article