Jan 07, 2026
Aris S. & Valentinas C.
6min Read
The open-source eCommerce platform OpenCart provides pre-built tools and features to create an online store more easily. It’s an excellent solution if you want to sell products online without building the store from scratch.
Being open-source also means OpenCart is flexible. For example, you can install it on various hosting environments, including a Linux virtual private server (VPS), which is suitable for a large-scale online store.
In this tutorial, we’ll explain how to install OpenCart on a VPS using two methods. The Hostinger VPS template is simpler and more beginner-friendly since it uses a graphical interface. Meanwhile, the manual installation suits users who prefer using commands for flexibility.
Before installing OpenCart, purchase a VPS hosting plan that provides ample resources based on the scale of your online store. Make sure your web host offers upgradable plans to accommodate your growing eCommerce needs.
OpenCart is lightweight and can run on a server with minimal resources. However, as your store features more products and handles more transactions, it will consume more computing power.
If you are just starting a small online shop, Hostinger’s OpenCart hosting KVM 1 can be an excellent option. Featuring a single-core CPU, 4 GB of RAM, and 50 GB of storage, it should be sufficient for a store with dozens of products and daily transactions.
Once your eCommerce site grows, you can upgrade to up to KVM 8, which has 8 vCPU cores, 32 GB of RAM, and 400 GB of storage. Upgrading Hostinger VPS only takes a few minutes and our system will automatically migrate your files for a seamless process.
In addition to powerful hardware suitable for online stores of different sizes, Hostinger OpenCart hosting’s built-in features help improve your eCommerce administration efficiency.
The free automatic weekly backups ensure your store data is safe with minimal effort, while our built-in malware scanner helps safeguard your server from malicious software. Also, our Kodee AI assistant helps write commands, provides guidance, and manages various aspects of your eCommerce server, all based on simple prompts.
Our global data center also lets you host your OpenCart website closest to your buyer, ensuring a responsive shopping experience.

Hostinger VPS users can easily install OpenCart in a few clicks using the template. In addition to making the process more efficient and simple, it helps minimize errors since you won’t have to run any commands.
If you purchased the OpenCart VPS hosting plan, you can set up this platform by choosing the Ubuntu 24.04 with OpenCart template during the onboarding process. Once finished, you will be set.
Meanwhile, follow this installation process if you purchased the general VPS hosting plan or previously installed another template:

Wait until the OpenCart template installation process is complete, which should take about 10 minutes. Once finished, click Manage App on the top menu to access the platform’s dashboard.

If the panel is inaccessible, it might be due to the hostname not resolving to the IP address properly. To fix it, open your local computer’s /etc/hosts file and add the following line:
185.185.185.185 your.vps.hostname
Remember to change the IP address and server hostname with the actual value.
If you want to use other operating systems or need more flexibility in configuring OpenCart, you can install it manually using commands. Here are the steps to do so.
Before running installation commands on your VPS, connect to the server using the PuTTY SSH client or terminal. If you use the latter, simply run the following command:
ssh root@185.185.185.185
Then, enter your root password. Hostinger VPS customers can find their server’s IP address and root login credentials by going to the VPS overview menu’s SSH access tab.

Alternatively, Hostinger users can access their VPS command-line interface (CLI) via their web browser using the Browser terminal. Simply click the button on the top right of your VPS overview menu, and you will log in automatically.
Updating your VPS repositories ensures you have the latest version of all software packages. Note that the commands differ depending on your Linux distribution.
For example, run the following command to update Ubuntu and other Debian-based operating systems’ repositories:
sudo apt update && apt upgrade
If you use another distribution or encounter difficulties when running the commands, we recommend asking the Kodee AI assistant for help. You can access this tool by going to hPanel’s VPS management menu and clicking the Kodee AI assistant button on the left sidebar.
For example, if you use Arch Linux, ask Kodee, “Write commands for updating and upgrading my Arch Linux server’s local repository.”

OpenCart requires three dependencies – PHP, a web server, and a database. In this tutorial, we will install Apache and MariaDB, but you can use another web server or database.
Set up PHP
To install PHP and other complementary modules, run the following:
sudo apt install php php-mysqli php-mbstring php-xml php-gd php-curl php-zip php-json
If your command line warns you about missing packages, rerun the command above with the –fix-missing option. Confirm that PHP is properly installed by running:
php -v
If the setup process is successful, your shell should output the installed PHP version.

Configure Apache
A web server like Apache enables your OpenCart store to receive and process user requests. Execute the command below to install it:
sudo apt install apache2
Once installed, start and enable the Apache web server on your VPS by running:
sudo systemctl enable apache2 sudo systemctl start apache2
Verify the web server status, which should appear as active (running) and enabled:
sudo systemctl status apache2

Configure MariaDB
OpenCart uses a database like MariaDB to store various data, such as users’ order details and item information. To install it, run:
sudo apt install mariadb-server
Then, execute this command to start the MariaDB security configuration. To learn more about the settings, check the mariadb-secure-installation documentation.
sudo mariadb-secure-installation
After setting up MariaDB, create a new database for your OpenCart online store. Here are the steps:
sudo mysql -u root -p
CREATE DATABASE opencart_db;
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON opencart_db.* TO 'username'@'localhost';
FLUSH PRIVILEGES;
EXIT;
After installing the required dependencies, it’s time to download and prepare the OpenCart files. Follow these steps:

wget https://github.com/opencart/opencart/archive/refs/heads/master.zip
sudo apt install unzip
sudo unzip master.zip -d /var/www/html/opencart
sudo cp /var/www/html/opencart/upload/config-dist.php /var/www/html/opencart/upload/config.php sudo cp /var/www/html/opencart/upload/admin/config-dist.php /var/www/html/opencart/upload/admin/config.php
sudo chown -R www-data:www-data /var/www/html/opencart sudo chmod -R 755 /var/www/html/opencart
Setting up an Apache virtual host file is important if you want to host multiple websites on your VPS or have a specific domain pointing to your OpenCart installation. Here are the instructions:
sudo nano /etc/apache2/sites-available/opencart.conf
<VirtualHost *:80>
ServerAdmin admin@yourdomain.com
DocumentRoot /var/www/html/opencart/upload/
ServerName yourdomain.com
ServerAlias www.yourdomain.com
<Directory /var/www/html/opencart/upload/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/yourdomain.com-error_log
CustomLog /var/log/apache2/yourdomain.com-access_log common
</VirtualHost>sudo a2dissite 000-default.conf sudo a2ensite opencart.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Now, finish setting up your store through OpenCart’s installation wizard with these steps:




sudo rm -rf /var/www/html/install
In this article, you’ve learned how to install OpenCart on a Linux VPS using Hostinger’s preconfigured template or manually. The template simplifies the process to just a few clicks, while manual setup offers greater flexibility, such as when using a different OS.
Regardless of the chosen method, you now have a flexible eCommerce platform capable of handling high traffic and numerous transactions. After completing the installation, explore OpenCart’s features to add products, customize your store’s design, and set up payment methods.
If you have further questions about OpenCart, feel free to use the comment box below.
OpenCart is a free, open-source eCommerce platform for creating and managing online stores without building everything from scratch. It’s flexible, customizable, and suitable for businesses of all sizes.
For beginners, we recommend using Hostinger’s OpenCart VPS template. This quick installation method lets you set up your store easily, avoiding command-line errors and requiring no technical expertise.
Yes, an SSL certificate is necessary to secure customer data, encrypt transactions, and build trust with shoppers. Check our guide to learn how to install a free SSL certificate on your VPS.
Comments
September 17 2020
unable to configure seo url in opencart htassess is not working
November 18 2020
Hey Siba. Please check Opencart's official info here.