How to Install Bagisto on Ubuntu 22.04
Bagisto is an eCommerce ecosystem designed for all to build and scale your business. It's a free and open-source eCommerce framework that offers you a wide range of functionality and lets you have total control of your store. Built on top of the Laravel stack, it is coupled with easy product information management and fast time to market the product. Besides, the framework is very flexible and easy to use even for non-tech savvies. In this article, we are going to learn how to install Bagisto on Ubuntu 22.04. So, let’s get started.
Pre-requisites :
-
A system with Ubuntu 22.04 installed and running.
root
access to the system.
Install Apache
To Install Apache
apt update
apt install apache2
systemctl start apache2
systemctl enable apache2
Install PHP 8.1
To Install PHP
apt-get install -y php8.1 php8.1-{common,gmp,curl,soap,bcmath,intl,mbstring,xmlrpc,mysql,gd,xml,cli,zip} libapache2-mod-php8.1
To Enable the Apache php8.1 module and restart the Apache Web server
a2enmod php8.1
a2enmod rewrite
systemctl restart apache2
To check PHP Version.
php -v
Install Node.js
apt-get install curl
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
apt-get install -y nodejs
Install the Composer
apt install composer
composer -V
output:
root@vps:~# composer -V
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? Y
Composer 2.2.6 2022-02-04 17:00:38
SSH User creation
Add the user that will run the bagisto application.
adduser bagisto
Now Switch to bagisto
su - bagisto
Download Bagisto
composer create-project bagisto/bagisto
cd bagisto/public
Apache configuration
nano /etc/apache2/sites-enabled/000-default.conf
You will find the following lines as shown below, after executing the above command. Now, change this to
DocumentRoot /home/bagisto/bagisto/public/
Configure the envvars
nano /etc/apache2/envvars
replace www-data to bagisto
Configure file apache2.conf
nano /etc/apache2/apache2.conf
Change it to the following code :
<Directory/home/bagisto/bagisto/public/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Create Database
apt-get install mysql-server
mysql -u root
CREATE DATABASE bagisto;
CREATE USER 'bagistouser'@'localhost' IDENTIFIED BY 'YOUR-PASSWORD-HERE';
Replace YOUR-PASSWORD-HERE with a Secure Strong Password
GRANT ALL ON bagisto.* TO 'bagistouser'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT
Make some changes to php.ini file.
nano /etc/php/8.1/apache2/php.ini
Edit the file using below config
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
Changes to php.ini file
Bagisto configuration
Go to the root directory for bagisto
cd /home/bagisto/bagisto
Now Edit the .env file with the mysql database
nano .env
Mysql database again and run the following command
SET GLOBAL log_bin_trust_function_creators = 1;
Install Bagisto
php artisan bagisto:install
Setting up File Permissions
chmod -R 755 /home/bagisto/bagisto
chown -R bagisto:bagisto /home/bagisto/bagisto
system restart apache2
Install SSL Certificate
Let us install the SSL Certificate from Let's Encrypt. For this, you will need to install certbot
via snapd
.
Installing snapd,
apt install snapd
Check the snapd for updates,
snap install core; sudo snap refresh core
Install Certbot
snap install --classic certbot
ln -s /snap/bin/certbot /usr/bin/certbot
Since we're using Apache web server, run the below command to get the certificate,
certbot --apache
The Certbot will take care of your renewal automatically before they expire, you would have to run the certbot again only if you make changes to your configuration. You can perform a test run with below command,
certbot renew --dry-run
Next, reload the page on the browser and it should then redirect and load the HTTPS site https://dev.domainhere.info
.
Accessing Bagisto Now open the URL from your browser, this will redirect you to the Bagisto.
https://dev.domainhere.info/
Replace the
dev.domainhere.info
with the actual IP or domain configured on the server.
Now you have successfully installed Bagisto on Ubuntu 22.04.
CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME
for 10% off!
1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month
Available Locations: LAX | MIA | ATL | FRA | AMS