How to Install Bagisto on Elementary OS Latest

Bagisto is an open-source eCommerce platform built on top of Laravel and Vue.js. In this tutorial, we'll cover the steps on how to install Bagisto on Elementary OS Latest.

Prerequisites

Before you start, make sure your system meets the following requirements:

Step 1: Install Required Packages

Before installing Bagisto, we need to install some required packages on our system. Open the terminal and run the following commands:

sudo apt update
sudo apt install -y apache2 mysql-server php7.4 php7.4-cli php7.4-common php7.4-curl php7.4-gd php7.4-intl php7.4-json php7.4-mbstring php7.4-mysql php7.4-xml libapache2-mod-php7.4
sudo apt install -y composer git nodejs npm

Step 2: Clone Bagisto Repository

Next, we'll clone the Bagisto repository from GitHub. Navigate to the Apache public HTML directory and clone the repository using the git command:

cd /var/www/html
sudo git clone https://github.com/bagisto/bagisto.git

Step 3: Install Bagisto Dependencies

Change the directory to the Bagisto project and install the Laravel dependencies using composer:

cd bagisto
sudo composer install --no-dev

Then, install the npm dependencies:

sudo npm install

Step 4: Configure the Environment Variables

Copy the .env.example file to .env:

sudo cp .env.example .env

And edit the .env file with your database information:

sudo nano .env

Change the following variables:

APP_NAME=Bagisto
APP_URL=http://localhost
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=bagisto
DB_USERNAME=root
DB_PASSWORD=

Step 5: Generate the Application Key

Generate the Laravel application key:

sudo php artisan key:generate

Step 6: Run Database Migrations

Before deploying Bagisto, run the database migrations:

sudo php artisan migrate

Step 7: Install Bagisto Assets

Compile and install the Bagisto assets:

sudo npm run prod

Step 8: Configure Apache/Nginx for Bagisto

For Apache, create a new virtual host configuration file:

sudo nano /etc/apache2/sites-available/bagisto.conf

And add the following configuration:

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

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

Enable the virtual host:

sudo a2ensite bagisto.conf
sudo systemctl restart apache2

For Nginx, create a new server block configuration file:

sudo nano /etc/nginx/sites-available/bagisto.conf

And add the following configuration:

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

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

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
            root /usr/share/nginx/html;
    }

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

    location ~ /\.(?!well-known).* {
            deny all;
    }
}

Enable the server block:

sudo ln -s /etc/nginx/sites-available/bagisto.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Step 9: Access Bagisto

Open your web browser and navigate to http://example.com (replace "example.com" with your domain name or IP address). You should see the Bagisto installation screen.

Fill out the required details and click on the "Install" button. Once the installation is complete, you can access the Bagisto admin panel by navigating to http://example.com/admin.

Congratulations! You've successfully installed Bagisto on your Elementary OS Latest system.

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!