How To Install LiteCart on Ubuntu 24.04 LTS
LiteCart is a robust and lightweight e-commerce platform designed to offer a seamless shopping experience for both merchants and customers. Its minimalist design ensures rapid performance without compromising on essential features, making it an excellent choice for small to medium-sized businesses looking to establish an online presence. Ubuntu 24.04 LTS, known for its stability and security, serves as an ideal operating system to host LiteCart. This guide provides a comprehensive, step-by-step approach to installing LiteCart on Ubuntu 24.04 LTS, ensuring a smooth and efficient setup.
Prerequisites
Before diving into the installation process, it’s crucial to ensure that your system meets all the necessary requirements and that you have the necessary tools and access rights.
System Requirements for LiteCart
- Hardware: At least a dual-core CPU, 2 GB of RAM, and 20 GB of disk space.
- Software: PHP 7.4 or higher, MySQL/MariaDB, and Apache or Nginx web server.
Preparing Your Ubuntu 24.04 LTS Server
- Update your system packages to ensure all repositories are up-to-date:
sudo apt update && sudo apt upgrade -y
- Ensure you have root or sudo access to perform administrative tasks.
Domain and SSL Certificate
- A registered domain name pointing to your server’s IP address is essential.
- For enhanced security, obtaining an SSL certificate is recommended. Let’s Encrypt offers free SSL certificates that can be easily integrated.
Step 1: Installing Required Software
Installing the necessary software stack is the foundational step for setting up LiteCart. This includes a web server, PHP, and a database server.
Install Apache Web Server
- Install Apache using the following command:
sudo apt install apache2 -y
- Enable Apache to start on boot:
sudo systemctl enable apache2
- Start Apache:
sudo systemctl start apache2
Install PHP and Extensions
- Install PHP along with necessary extensions:
sudo apt install php php-mysql php-gd php-curl php-xml php-mbstring -y
- Verify PHP installation:
php -v
Install MySQL Server
- Install MySQL:
sudo apt install mysql-server -y
- Secure MySQL installation:
sudo mysql_secure_installation
Follow the prompts to set the root password and secure your MySQL server.
Alternatively, you can opt for Nginx as your web server instead of Apache. The installation process is similar, but configurations will differ.
Step 2: Setting Up the Database
A dedicated database is essential for LiteCart to store all your e-commerce data securely.
- Log into MySQL as the root user:
sudo mysql -u root -p
- Create a new database and user for LiteCart:
CREATE DATABASE litecart_db; CREATE USER 'litecart_user'@'localhost' IDENTIFIED BY 'secure_password'; GRANT ALL PRIVILEGES ON litecart_db.* TO 'litecart_user'@'localhost'; FLUSH PRIVILEGES; EXIT;
Replace
'secure_password'
with a strong, unique password. - Test database access:
mysql -u litecart_user -p litecart_db
Step 3: Downloading and Extracting LiteCart
With the database set up, the next step involves downloading LiteCart and preparing it for installation.
- Navigate to the Apache web root directory:
cd /var/www/html/
- Download the latest LiteCart package. As versions update, ensure you download the most recent stable release:
wget [url]
- Install unzip if not already installed:
sudo apt install unzip -y
- Extract the downloaded archive:
sudo unzip litecart.zip -d litecart
- Set appropriate ownership and permissions to ensure the web server can access and modify necessary files:
sudo chown -R www-data:www-data /var/www/html/litecart sudo chmod -R 755 /var/www/html/litecart
Step 4: Configuring Apache for LiteCart
Proper web server configuration ensures that LiteCart runs smoothly and securely.
Creating a Virtual Host Configuration
- Create a new Apache configuration file for LiteCart:
sudo nano /etc/apache2/sites-available/litecart.conf
- Add the following configuration, replacing
yourdomain.com
with your actual domain name:<VirtualHost *:80> ServerName yourdomain.com DocumentRoot /var/www/html/litecart <Directory /var/www/html/litecart> AllowOverride All </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
- Enable the new site and the mod_rewrite module:
sudo a2ensite litecart.conf sudo a2enmod rewrite
- Test Apache configuration for syntax errors:
sudo apache2ctl configtest
You should see Syntax OK if there are no issues.
- Restart Apache to apply the changes:
sudo systemctl restart apache2
If you opted for Nginx instead of Apache, ensure you create the appropriate server block configurations and test them using nginx -t
.
Step 5: Running the LiteCart Installer
With the server and LiteCart files in place, the final installation steps involve configuring LiteCart through its web-based installer.
- Open your web browser and navigate to
http://yourdomain.com/install/
. - Follow the on-screen instructions:
- License Agreement: Accept the terms to proceed.
- System Check: LiteCart will verify that all server requirements are met.
- Database Configuration:
- Enter the database details:
- Database Host:
localhost
- Database Name:
litecart_db
- Database User:
litecart_user
- Database Password: The password you set earlier.
- Database Host:
- Enter the database details:
- Store Information: Provide your store’s name, email, and admin account details.
- Complete the installation by clicking the Install Now button.
- For security purposes, remove the installation directory:
sudo rm -rf /var/www/html/litecart/install/
Step 6: Securing Your LiteCart Installation
Ensuring your e-commerce platform is secure is paramount to protect both your business and your customers.
Enable HTTPS with Let’s Encrypt
- Install Certbot, the Let’s Encrypt client:
sudo apt install certbot python3-certbot-apache -y
- Obtain and install the SSL certificate:
sudo certbot --apache -d yourdomain.com
Follow the interactive prompts to complete the SSL setup.
- Set up automatic certificate renewal to ensure your SSL certificate remains valid:
sudo systemctl enable certbot.timer
Additional Security Measures
- File Permissions: Ensure that sensitive files have restricted permissions.
sudo chmod -R 755 /var/www/html/litecart
- Regular Updates: Keep your server packages and LiteCart installation updated to patch any vulnerabilities:
sudo apt update && sudo apt upgrade -y
- Firewall Configuration: Use UFW to allow only necessary ports:
sudo ufw allow 'Apache Full' sudo ufw enable
Congratulations! You have successfully installed LiteCart. Thanks for using this tutorial for installing LiteCart in Ubuntu 24.04 LTS systems. For additional help or useful information, we recommend you check the official LiteCart website.