Bagisto is a powerful eCommerce ecosystem that enables businesses to build and scale their online stores. As a free and open-source framework built on top of the Laravel stack, Bagisto offers a wide range of functionalities and provides complete control over your store. In this article, we will guide you through the step-by-step process of installing Bagisto on Ubuntu 23.10, ensuring a seamless setup for your online business.
Pre-requisites
Before we begin, make sure you have the following pre-requisites in place:
- A system with Ubuntu 23.10 installed and running.
- Root access to the system.
Step 1: Update Package Repository
First, log in to your Ubuntu 23.10 server and update the package repository information by running the following commands:
apt update apt upgrade
Step 2: Install Apache Web Server
To install and configure Apache web server, execute the following commands:
apt update apt install apache2 systemctl start apache2 systemctl enable apache2
Step 3: Install PHP 8.2
Next, install PHP 8.2 along with the necessary modules by running the following command:
apt-get install -y php8.2 php8.2-{common,gmp,curl,soap,bcmath,intl,mbstring,xmlrpc,mysql,gd,xml,cli,zip} libapache2-mod-php8.2
To enable the Apache php8.2 module, use the following command, and restart the Apache Web server:
a2enmod php8.2 systemctl restart apache2
Step 4: Install Node.js
To install Node.js, we’ll use nvm (Node Version Manager). Execute the following command in your terminal:
wget -qO https://raw.githubusercontent.com/creationix/nvm/v0.39.3/install.sh | bash
Update your shell ~/.profile by running the following command:
source ~/.profile
Next, list all available Node.js versions by executing the command:
nvm ls-remote
Choose the desired Node.js version and install it using the following command, replacing “v21.0.0” with the version number you want:
nvm instal l21.0.0
To verify the installation, run the command:
node -v
Step 5: Install Composer
To install Composer, use the following command:
apt install composer
To confirm the installation and check the version, run the command:
composer -V
Note: It is important not to run Composer as the root user. For more details, refer to the official documentationhere.
Step 6: Create SSH User
To add a new user for running the Bagisto application, execute the following command:
adduser bagisto
You will be prompted to set a new password for the user. Enter a strong password, your complete name, and any other necessary details. Confirm the information by selecting “Y” for verification.
Next, add the newly created user “bagisto” to the “sudo” group using the “usermod” command:
usermod -aG sudo bagisto
Now, switch to the “bagisto” user for the remaining steps:
su - bagisto
Step 7: Download Bagisto
To download Bagisto, use the following command:
composer create-project bagisto/bagisto cd bagisto/public
Step 8: Configure Apache
Now, let’s configure Apache web server to work with Bagisto. Open the 000-default.conf
configuration file using the following command:
sudo nano /etc/apache2/sites-enabled/000-default.conf
In the file, locate the line DocumentRoot /var/www/html
and change it to:
DocumentRoot /home/bagisto/bagisto/public/
Next, open the envvars
file for configuration:
sudo nano /etc/apache2/envvars
Make the following changes to the file:
exportAPACHE_RUN_USER=bagisto exportAPACHE_RUN_GROUP=bagisto
Now, open the apache2.conf
file:
sudo nano /etc/apache2/apache2.conf
Replace the existing code with the following:
<Directory /home/bagisto/bagisto/public/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Save the changes and exit the file.
Step 9: Create MySQL Database
Switch back to the root user:
su root
If MySQL server is not installed on your server, install it using the following command:
apt-get install mysql-server
Access the MySQL server using the following command:
mysql -u root
Create a new database for Bagisto:
CREATE DATABASE bagisto;
Create a database user with a secure password:
CREATE USER 'bagistouser'@'localhost' IDENTIFIED BY 'YOUR-PASSWORD-HERE';
Replace “YOUR-PASSWORD-HERE” with a strong password of your choice.
Assign the necessary permissions to the database user:
GRANT ALL ON bagisto.* TO 'bagistouser'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES; EXIT;
Step 10: Configure PHP
Edit the php.ini
file using the following command:
nano /etc/php/8.2/apache2/php.ini
Make the following changes to the file:
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
Save the changes and exit the file.
Step 11: Configure Bagisto
Switch back to the Bagisto directory:
cd /home/bagisto/bagisto
Open the .env
file and update the MySQL database details:
nano .env
Make the following changes in the file:
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=bagisto DB_USERNAME=bagistouser DB_PASSWORD=YOUR-PASSWORD-HERE DB_PREFIX=
Replace “YOUR-PASSWORD-HERE” with the password you set for the database user.
Step 12: Install Bagisto
To install Bagisto, run the following command:
php artisan bagisto:install
Once the installation is complete, you will receive a message with the login details for the Bagisto admin panel.
Step 13: Set File Permissions
To ensure proper file permissions, execute the following commands:
chmod -R 755 /home/bagisto/bagisto chown -R bagisto:bagisto /home/bagisto/bagisto systemctl restart apache2
Step 14: Install SSL Certificate
To secure your Bagisto installation with an SSL certificate, install certbot via snapd using the following commands:
apt install snapd snap install core; sudo snap refresh core snap install --classic certbot ln -s /snap/bin/certbot /usr/bin/certbot
Since we’re using Apache web server, run the following command to obtain and install the certificate:
certbot --apache
Certbot will automatically handle the renewal of your certificate before it expires. You will only need to run the certbot command again if you make changes to your configuration.
You can perform a test run of the renewal process with the following command:
certbot renew --dry-run
Once the certificate is installed, your Bagisto site will be accessible via HTTPS.
Step 15: Accessing Bagisto
You can now access your Bagisto admin panel by visiting the following URL:
https://bagisto.domainhere.info/admin
Replace “bagisto.domainhere.info” with the actual IP or domain configured on your server. Use the login credentials provided during the installation process to authenticate.
To view and manage your Bagisto store, visit the following URL:
https://bagisto.domainhere.info/
Remember to replace “bagisto.domainhere.info” with your own IP or domain.
Congratulations! You have successfully installed Bagisto on your Ubuntu 23.10 server. Start exploring the wide range of features and functionalities that Bagisto offers to build and scale your online business.
For reliable and scalable cloud hosting solutions, check out Shape.host’s Cloud VPS services. Shape.host provides efficient and secure hosting solutions tailored to meet the needs of businesses in the digital age.
Happy selling with Bagisto and Shape.host!