Bagisto is a powerful and flexible eCommerce software that offers a seamless online shopping experience. Built on the Laravel PHP framework and Vue.js, Bagisto provides a fast, responsive, and user-friendly platform to set up your online store. In this comprehensive guide, we will walk you through the step-by-step process of installing Bagisto eCommerce on Debian 11 Bullseye. By following these instructions, you will be able to create a successful online store and unlock the full potential of Bagisto’s features.
Prerequisites
Before we begin the installation process, make sure you have the following prerequisites in place:
- A server running Debian 11 Bullseye.
- Root or sudo access to the server.
- A domain name pointed to your server’s IP address.
Installing the LEMP Stack
To get started, we need to install the LEMP (Linux, Nginx, MariaDB, PHP) stack on your Debian server. Bagisto requires PHP version 7.4 or higher, MariaDB version 10.2.17 or higher, and Nginx as the web server.
To update your server’s repository, run the following command:
sudo apt update
Next, install the necessary packages by executing the following command:
sudo apt install nginx-full mariadb-server php-fpm php-cli php-common php-zip php-mysql php-gd php-intl php-curl php-imap php-mbstring php-xml php-json libpcre3 git unzip -y
Once the installation is complete, we need to edit the PHP configuration files to adjust some settings. Open the php.ini
file using a text editor:
sudo nano /etc/php/7.4/fpm/php.ini
Locate the following options and modify them to match your environment:
memory_limit = 512M max_execution_time = 360 date.timezone = America/Toronto
Save the file and exit the text editor. Now, restart the PHP-FPM service to apply the changes:
sudo systemctl restart php7.4-fpm
Congratulations! You have successfully installed the LEMP stack on your Debian 11 server, which will serve as the foundation for running Bagisto eCommerce.
Setting Up MariaDB Root Password
After installing the LEMP stack, it’s essential to set up the root password for the MariaDB database. To do this, we will use the mysql_secure_installation
command-line tool, which provides a secure way to configure MariaDB.
Run the following command to start the secure installation process:
sudo mysql_secure_installation
You will be prompted to answer a series of questions. Follow the instructions below:
- Press ENTER to set up the root password for MariaDB.
- Type ‘Y’ to switch the root user authentication to the ‘unixsocketauthentication’ method.
- Type ‘Y’ to set up the root password, enter your desired password, and confirm it.
- Type ‘Y’ to remove the MariaDB anonymous user.
- Type ‘Y’ to disable remote login for the root user.
- Type ‘Y’ to remove the default database ‘test’ and any privileges associated with it.
- Type ‘Y’ to reload all table privileges and apply the changes.
By completing these steps, you have successfully secured your MariaDB installation.
Setting Up a New Database and User for Bagisto
Now that MariaDB is configured, we need to create a new database and user specifically for Bagisto eCommerce. To do this, we will log in to the MariaDB shell and execute a series of SQL commands.
To access the MariaDB shell, run the following command:
sudo mysql -u root -p
You will be prompted to enter the root password you set earlier. Once authenticated, enter the following commands to create a new database and user:
CREATE DATABASE bagisto; CREATE USER bagistouser@localhost IDENTIFIED BY 'BagistoPassword';
Replace ‘BagistoPassword’ with a strong password of your choice. Next, grant the necessary privileges to the user and flush the privileges to apply the changes:
GRANT ALL ON bagisto.* TO bagistouser@localhost WITH GRANT OPTION; FLUSH PRIVILEGES;
Exit the MariaDB shell by typing ‘exit’ and pressing ENTER.
Installing Composer
Composer is a dependency management tool for PHP that we will use to install Bagisto eCommerce. To install Composer, run the following commands:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');"
This will download the Composer installer script, verify its integrity, and install Composer on your system. To ensure the installation was successful, run the following command:
sudo -u www-data composer --version
If you see the Composer version displayed, you have successfully installed Composer.
Installing Bagisto eCommerce with Composer
With Composer installed, we can now proceed to install Bagisto eCommerce. Follow the steps below to complete the installation:
- Create two directories,
.cache
and.config
, under the/var/www/
directory, and change their ownership to thewww-data
user. These directories will be used to store Composer’s cache and configuration files:
mkdir -p /var/www/{.cache,.config} sudo chown -R www-data:www-data /var/www/{.cache,.config}
- Create a directory named
project
under/var/www/
, and change its ownership to thewww-data
user. This directory will be the installation location for Bagisto eCommerce:
mkdir -p /var/www/project sudo chown -R www-data:www-data /var/www/project
- Change your working directory to
/var/www/project
:
cd /var/www/project
- Run the following command to download and install Bagisto eCommerce:
sudo -u www-data composer create-project bagisto/bagisto
This command will download the Bagisto source code and all its PHP dependencies.
- Once the installation is complete, navigate to the
/var/www/project/bagisto
directory and open the.env
file using a text editor:
cd /var/www/project/bagisto sudo nano.env
- Inside the
.env
file, modify the following fields to match your environment:
APP_NAME=Bagisto APP_ENV=production APP_DEBUG=false APP_URL=https://www.example.io DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=bagisto DB_USERNAME=bagistouser DB_PASSWORD=BagistoPassword DB_PREFIX=
Save the file and exit the text editor.
- Run the following command to install Bagisto eCommerce:
sudo -u www-data php artisan bagisto:install
You will be prompted to confirm the installation. Type ‘yes’ and press ENTER to proceed.
- During the installation process, Bagisto will generate a default admin username and password for you to access the admin dashboard. Make note of these credentials for future reference.
- Finally, ensure that the ownership of the Bagisto installation directory is set to
www-data
:
sudo chown -R www-data:www-data /var/www/project/bagisto
Congratulations! You have successfully installed Bagisto eCommerce on your Debian 11 server.
Setting Up Nginx Web Server
To serve Bagisto eCommerce, we need to configure Nginx, a high-performance web server. Follow the steps below to set up Nginx for Bagisto:
- Create a new server block configuration file named
bagisto
using a text editor:
sudo nano /etc/nginx/sites-available/bagisto
- Copy and paste the following Nginx configuration into the file:
server { listen 80; server_name example.io; return 302 https://$server_name$request_uri; } server { listen 443 ssl http2; server_name example.io; root /var/www/bagisto/public; index index.php; ssl_certificate /etc/letsencrypt/live/example.io/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.io/privkey.pem; ssl_protocols TLSv1.2; ssl_prefer_server_ciphers on; ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384; ssl_ecdh_curve secp384r1; ssl_session_timeout 10m; ssl_session_cache shared:SSL:10m; ssl_session_tickets off; resolver 8.8.8.8 8.8.4.4 valid=300s; resolver_timeout 5s; add_header X-Frame-Options DENY; add_header X-Content-Type-Options nosniff; add_header X-XSS-Protection "1; mode=block"; access_log /var/log/nginx/example.com.access.log; error_log /var/log/nginx/example.com.error.log; client_max_body_size 100M; autoindex off; location / { try_files $uri /index.php$is_args$args; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; include fastcgi_params; fastcgi_intercept_errors on; } }
Replace example.io
with your own domain name. If you have SSL certificates, update the paths accordingly. Otherwise, you can obtain SSL certificates later.
- Save the file and exit the text editor.
- Create a symbolic link to enable the
bagisto
server block:
sudo ln -s /etc/nginx/sites-available/bagisto /etc/nginx/sites-enabled/
- Verify the Nginx configuration for syntax errors:
sudo nginx -t
If there are no errors, you will see the message “Syntax OK”.
- Restart the Nginx service to apply the new configuration:
sudo systemctl restart nginx
Congratulations! You have successfully set up Nginx as the web server for your Bagisto eCommerce store.
Verifying Bagisto eCommerce Installation
To verify that Bagisto eCommerce is installed correctly and accessible, open your web browser and enter your domain name in the address bar. For example, if your domain is www.example.io
, enter https://www.example.io/
.
You should see the default homepage of your Bagisto eCommerce store.
To access the admin dashboard, open a new tab and visit https://www.example.io/admin
. Enter the default admin username and password provided during the installation process.
Once logged in, you will have access to the admin dashboard, where you can manage your products, configure payment plugins, and customize your store’s settings.
Conclusion
Congratulations! You have successfully installed Bagisto eCommerce on your Debian 11 Bullseye server. By following this guide, you now have a powerful and feature-rich platform to create and manage your online store. Bagisto’s flexible architecture, combined with the robustness of the LEMP stack, ensures a seamless and secure shopping experience for your customers.
Shape.host is a trusted provider of Linux SSD VPS services, offering reliable and scalable cloud hosting solutions. With Shape.host, you can take advantage of their expertise in managing high-performance servers, ensuring your Bagisto eCommerce store runs smoothly and efficiently. Visit Shape.host today and experience the benefits of their cutting-edge hosting solutions.