How to Install Bagisto on Kali Linux

Bagisto is an open-source e-commerce platform built on top of Laravel, a popular PHP web application framework. In this tutorial, we will guide you through the steps to install Bagisto on Kali Linux, the newest version of Debian-based Linux distribution.

Prerequisites

Step 1 - Update the System

Before proceeding with the Bagisto installation, update the system packages to their latest versions by running the following command:

sudo apt-get update && sudo apt-get upgrade

Step 2 - Install PHP and Other Dependencies

Bagisto requires PHP 7.2 or higher, along with some PHP extensions. To install PHP and its required extensions on your Kali Linux system, run the following command:

sudo apt-get install php7.4 php7.4-mysql php7.4-curl php7.4-json php7.4-mbstring php7.4-xml

Step 3 - Install Composer

Composer is a popular package manager for PHP that is commonly used to install and manage dependencies in web applications. To install Composer on your Kali Linux system, run the following command:

sudo apt-get install composer

Step 4 - Setup the Database

Bagisto requires a database for storing its data. You can use either MySQL or MariaDB as your database server. To install MariaDB on your Kali Linux system, run the following command:

sudo apt-get install mariadb-server mariadb-client

After installing MariaDB, start the MariaDB service and enable it to start automatically at boot time by running the following commands:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Once the MariaDB service is running, run the following command to setup the database for Bagisto:

sudo mysql -u root -p

This will prompt you to enter the MySQL root user password. After successfully entering the password, you will be taken to the MySQL command prompt. At the prompt, run the following commands to create a new database and a user for Bagisto:

CREATE DATABASE bagisto_db;
CREATE USER 'bagisto_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON bagisto_db.* TO 'bagisto_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

In the above commands, replace 'password' with a strong password of your choice.

Step 5 - Install and Setup Bagisto

To get started with the installation of Bagisto, navigate to your desired installation directory and clone the Bagisto repository by running the following command:

git clone https://github.com/bagisto/bagisto.git

After cloning the Bagisto repository, navigate to the newly created directory and install Bagisto dependencies by running the following command:

cd bagisto
composer install

Next, copy the .env.example file to a new file named .env by running the following command:

cp .env.example .env

After copying the .env.example file to .env, open the .env file in your preferred text editor and update the following database related configuration parameters:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=bagisto_db
DB_USERNAME=bagisto_user
DB_PASSWORD=password

In the above configuration, make sure you replace 'password' with the actual password you set for the bagisto_user in step 4.

After updating the configuration file, generate a new encryption key for the application by running the following command:

php artisan key:generate

Finally, run the migration command to create the required tables in the database:

php artisan migrate

This may take several minutes, depending on your system resources.

Step 6 - Configure the Webserver

To serve your Bagisto installation through a web server, you will need to configure your webserver to point to the public directory of the installation. You will also need to enable the necessary PHP extensions in your web server configuration file.

Apache

If you are using an Apache web server, you can use the following virtual host configuration to serve Bagisto:

<VirtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot /var/www/html/bagisto/public
    ServerName example.com

    <Directory /var/www/html/bagisto/public>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined  
</VirtualHost>

After saving the above configuration, restart the Apache service to apply the changes:

sudo systemctl restart apache2

Nginx

If you are using an Nginx web server, you can use the following server block configuration to serve Bagisto:

server {
    listen 80;
    server_name example.com;
    root /var/www/html/bagisto/public;

    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

After saving the above configuration, reload the Nginx service to apply the changes:

sudo systemctl reload nginx

Step 7 - Access Bagisto

After completing the above steps, you should be able to access your Bagisto installation by navigating to your server's hostname or IP address in a web browser. You will be prompted to complete the installation wizard, where you will set up an admin user, default currency, and other application settings.

Congratulations! You have successfully installed Bagisto on your Kali Linux system. You can now begin adding products, managing orders, and customizing 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!