1. Deploying Prerequisites
a. Installing and Configuring Firewalld
Begin by installing the firewalld package, starting the service, and enabling it to automatically run on system reboot:b. Installing and Configuring MariaDB
Install the MariaDB server and, if necessary, modify its configuration file. Then start and enable the MariaDB service:/etc/my.cnf) may have settings similar to:
Leave these settings as default unless you require any custom changes, such as modifying the port.
2. Configuring the Database
a. Creating the Database and User
Start by entering the MariaDB prompt:SHOW DATABASES; will list “ecomdb”.
b. Loading Inventory Data
The repository provides a SQL script (usually in the assets directory nameddb-load-script.sql) that creates a “products” table and inserts sample data.
-
Create the SQL script file:
-
Open the file in your favorite text editor and insert the following:
-
Save the file and load it into MySQL:
-
Finally, verify the data load by logging back into MariaDB and executing:
3. Deploying and Configuring the Web Server
a. Installing Apache, PHP, and PHP-MySQL
Install the necessary packages to run a web server with PHP support:index.php:
b. Downloading the Application Code
Ensure Git is installed:index.php.
c. Verifying the Application
Before making adjustments, verify that the application is accessible by using a web browser or curl:d. Updating the Database Connection in index.php
Open theindex.php file from the cloned repository and update the database connection details. Replace any external IP address (e.g., 172.20.1.101) with localhost and ensure the username, password, and database name match your configuration:
4. Optional: Handling index.html vs. index.php
If anindex.html file exists in the document root of your web server, Apache might serve that file by default over index.php. To ensure that Apache serves the e-commerce application:
-
Either remove/rename the
index.htmlfile, or -
Update the
DirectoryIndexdirective in/etc/httpd/conf/httpd.confas shown below:
Thank you for following this guide on deploying the KodeKloud ECommerce Application. With both the web server and the application correctly configured along with its database, your e-commerce site should now be fully operational. For further reading on web server deployment and database configuration concepts, consider checking out these resources:
Regularly back up your configuration files and database to prevent data loss and ease recovery in case of system failures.