How To Install Zen Cart on Ubuntu 24.04 LTS

Zen Cart is a renowned open-source e-commerce platform trusted by numerous online store owners worldwide. Combining flexibility with robust features, Zen Cart allows you to create and manage your online store with ease. Ubuntu 24.04, known for its stability and performance, serves as an excellent operating system to host Zen Cart. This guide provides a detailed, step-by-step process to install Zen Cart on Ubuntu 24.04, ensuring a smooth setup for your e-commerce venture.
Prerequisites and System Requirements
Before diving into the installation process, it’s essential to ensure that your system meets the necessary prerequisites and system requirements. This preparation ensures a seamless installation and optimal performance of your Zen Cart store.
Hardware Requirements
- Minimum RAM: 1 GB
- Recommended RAM: 3 GB or more
- Minimum Storage: 5 GB
- Recommended Storage: 25 GB or more
Software Requirements
- Operating System: Ubuntu 24.04
- LAMP Stack: Linux, Apache, MySQL, PHP
- Supported PHP Versions: PHP 8.1 or higher
- Required PHP Extensions: `mysqli`, `curl`, `gd`, `mbstring`, `xml`, `zip`
User Privileges
A non-root user with sudo privileges is required to perform the installation tasks securely.
Domain Name
Having a registered domain name is crucial for your online store. It not only enhances your store’s professionalism but also aids in SEO optimization.
Update and Prepare the Ubuntu System
Starting with an updated system ensures that all packages are current, minimizing compatibility issues during installation.
Update System Packages
Execute the following commands to update your system’s package list and upgrade existing packages:
sudo apt update && sudo apt upgrade -yInstall Essential Utilities
Installing utilities like wget and unzip is necessary for downloading and extracting Zen Cart files:
sudo apt install wget unzip -yInstall Apache Web Server
Apache is a reliable and widely-used web server that will serve your Zen Cart application to users.
Installation
Run the following command to install Apache:
sudo apt install apache2 -yVerification
Ensure that Apache is installed and running correctly:
sudo systemctl status apache2Enable Apache on Boot
To ensure Apache starts automatically on system boot:
sudo systemctl enable apache2Install PHP and Required Extensions
PHP is the backbone of Zen Cart, handling server-side scripting and dynamic content generation.
Installation
Install PHP along with necessary extensions using the following command:
sudo apt install php libapache2-mod-php php-mysql php-curl php-gd php-mbstring php-xml php-zip -yVerify PHP Installation
Check the installed PHP version to ensure compatibility:
php -vConfigure PHP Settings
Adjust PHP configurations to meet Zen Cart’s requirements. Open the PHP configuration file:
sudo nano /etc/php/8.1/apache2/php.iniModify the following settings as needed:
- memory_limit: Increase to at least 256M
- upload_max_filesize: Set to 50Mor higher
- post_max_size: Set to 50Mor higher
Save and close the file, then restart Apache to apply the changes:
sudo systemctl restart apache2Set Up MySQL Database for Zen Cart
A dedicated MySQL database is essential for storing your Zen Cart store’s data, including products, orders, and customer information.
Install MySQL Server
Install MySQL using the following command:
sudo apt install mysql-server -ySecure MySQL Installation
Run the security script to enhance MySQL’s security:
sudo mysql_secure_installationFollow the prompts to set up a root password, remove anonymous users, disallow root login remotely, remove the test database, and reload the privilege tables.
Create Database and User
Log in to the MySQL shell to create a new database and user for Zen Cart:
sudo mysql -u root -pWithin the MySQL shell, execute the following commands:
CREATE DATABASE zencart;
GRANT ALL PRIVILEGES ON zencart.* TO 'zencartuser'@'localhost' IDENTIFIED BY 'your_secure_password';
FLUSH PRIVILEGES;
EXIT;Ensure you replace 'your_secure_password' with a strong password.
Download and Extract Zen Cart Files
Obtain the latest Zen Cart files from the official repository to ensure you have the most recent features and security updates.
Download Zen Cart
Use wget to download the Zen Cart package:
wget https://sourceforge.net/projects/zencart/files/latest/download -O zencart.zipExtract the Files
Extract the downloaded ZIP file:
unzip zencart.zip -d zencartMove Files to Web Root
Transfer the Zen Cart files to the Apache web root directory:
sudo mv zencart /var/www/html/zencartConfigure File Permissions
Proper file permissions are critical for the security and functionality of your Zen Cart installation.
Set Ownership
Assign ownership of the Zen Cart files to the Apache user:
sudo chown -R www-data:www-data /var/www/html/zencart/Adjust Permissions
Set appropriate file permissions to restrict unauthorized access:
sudo chmod -R 755 /var/www/html/zencart/This ensures that the owner has full access while others have read and execute permissions.
Configure Apache for Zen Cart
Apache needs to be configured to recognize and serve your Zen Cart application correctly.
Create a Virtual Host Configuration
Generate a new Apache configuration file for Zen Cart:
sudo nano /etc/apache2/sites-available/zencart.confInsert the following configuration, replacing your-domain.com and admin@your-domain.com with your actual domain and admin email:
<VirtualHost *:80> ServerName your-domain.com ServerAdmin admin@your-domain.com DocumentRoot /var/www/html/zencart <Directory /var/www/html/zencart> Options -Indexes +FollowSymLinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Enable the Site and Rewrite Module
Activate the new site configuration and enable Apache’s rewrite module:
sudo a2ensite zencart.confsudo a2enmod rewriteRestart Apache
Apply the changes by restarting Apache:
sudo systemctl restart apache2Complete Installation via Web Interface
With the server-side setup complete, the final step is to finalize Zen Cart’s installation through its web-based interface.
Access the Installer
Open your web browser and navigate to http://your-domain.com/zc_install. This URL initiates the Zen Cart installation wizard.
Follow the Installer Prompts
- Welcome Page: Click on “CLICK HERE to begin installation” to proceed.
- System Inspection:The installer checks your server for necessary configurations. Ensure all checks pass before moving forward. If any issues are highlighted, address them accordingly.
- License Agreement: Accept the license terms to continue.
- Database Configuration:Enter the database details you set up earlier:
- Database Name: zencart
- Database User: zencartuser
- Database Password: your_secure_password
 
- Store Configuration:Set up your store’s administrative details, including admin username, password, and contact email.
- Demo Data (Optional): Choose to load demo data if you want a sample store layout.
- Finalize Installation: Complete the installation and proceed.
Remove Installation Directory
For security purposes, delete the installation directory after successful setup:
sudo rm -rf /var/www/html/zencart/zc_install/Post-installation Configuration
Enhancing the security and performance of your Zen Cart store ensures a trustworthy shopping environment for your customers.
Secure the Admin Panel
Rename the admin folder to prevent unauthorized access:
mv /var/www/html/zencart/admin /var/www/html/zencart/custom_admin_folder_name/Set Up HTTPS with SSL Certificates
Implement SSL to secure data transmission between your server and clients:
sudo apt install certbot python3-certbot-apache -ysudo certbot --apacheFollow the prompts to obtain and install the SSL certificate.
Troubleshooting Common Issues
Encountering issues during installation is common. Here are solutions to some frequent problems:
Permissions Errors
If you face permission-related errors, verify the ownership and permissions of the Zen Cart files:
sudo chown -R www-data:www-data /var/www/html/zencart/
sudo chmod -R 755 /var/www/html/zencart/Database Connection Issues
Should there be trouble connecting to the database, double-check the credentials in the includes/configure.php file:
DB_SERVER
DB_SERVER_USERNAME
DB_SERVER_PASSWORD
DB_DATABASEApache Errors
Review the Apache error logs to identify and resolve server-related issues:
sudo tail -f /var/log/apache2/error.logCongratulations! You have successfully installed Zen Cart. Thanks for using this tutorial for installing Zen Cart e-Commerce on your Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official Zen Cart website.
