# How to Install OpenCart on Rocky Linux 10

> URL: https://www.atlantic.net/dedicated-server-hosting/how-to-install-opencart-on-rocky-linux-10/ | Published: 2021-10-15 | Updated: 2025-10-21 | Author: Hitesh Jethva

OpenCart is an open-source e-commerce platform written in PHP. It is simple, lightweight, user-friendly, and provides a web interface to manage it from the web browser. It allows you to easily manage product inventory, orders, affiliates, discounts, product reviews, payment gateways, and more. OpenCart comes with a lot of plugins and themes that help you to make your store more attractive and powerful. If you are looking to host your own online store, then OpenCart is a great choice for you.

In this tutorial, we will show you how to install OpenCart on Rocky Linux 10.

## Step 1 – Install Apache, MariaDB, and PHP

First, you will need to install Apache web server and MariaDB to your system. You can install them using the following command:

```
dnf install httpd mariadb-server -y
```

After installing both packages, you will also need to install PHP version 8.3 and all required extensions.

First, install the EPEL with the following command:

```
dnf install epel-release -y
```

Finally, install PHP with all required extensions using the following command:

```
dnf install php php-gd php-ldap php-zip php-odbc php-pear php-xml php-mbstring php-mysqlnd php-snmp php-soap curl curl-devel unzip git -y
```

Once all the packages are installed, start the Apache and MariaDB service and enable them to start at system reboot:

```
systemctl start httpd
systemctl enable httpd
systemctl start mariadb
systemctl enable mariadb
```

## Step 2 – Create OpenCart Database

OpenCart uses MariaDB as a database backend, so you will need to create a database and user for OpenCart.

First, secure the MariaDB installation and set the MariaDB root password using the following command:

```
mysql_secure_installation
```

Answer all the questions as shown below:

```
Enter current password for root (enter for none): 
Set root password? [Y/n] Y
New password: 
Re-enter new password: 
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
```

Next, log in to MariaDB using the following command:

```
mysql -u root -p
```

Once you are logged in, create a user and database with the following command:

```
CREATE DATABASE opencart;
CREATE USER 'opencart'@'localhost' IDENTIFIED BY 'password';
```

Next, grant all the privileges to the OpenCart database with the following command:

```
GRANT ALL PRIVILEGES ON opencart.* TO 'opencart'@'localhost';
```

Next, flush the privileges and exit from MariaDB with the following command:

```
FLUSH PRIVILEGES;
EXIT;
```

## Step 3 – Download OpenCart

You can download the latest version of the OpenCart from the GitHub repository using the following command:

```
git clone https://github.com/opencart/opencart.git
```

Once the download is completed, change the directory to the downloaded directory and copy the upload directory to Apache web root directory:

```
cd opencart
mv upload /var/www/html/opencart
```

You will also need to copy the sample configuration file:

```
cp /var/www/html/opencart/config-dist.php /var/www/html/opencart/config.php
cp /var/www/html/opencart/admin/config-dist.php /var/www/html/opencart/admin/config.php
```

Next, set proper permissions and ownership using the following command:

```
chown -R apache:apache /var/www/html/opencart
chmod -R 777 /var/www/html/opencart
```

## Step 4 – Configure Apache to Host OpenCart

Next, you will need to create an Apache virtual host configuration file to host OpenCart on the internet:

```
nano /etc/httpd/conf.d/opencart.conf
```

Add the following lines:

```
<VirtualHost *:80>
ServerAdmin admin@yourdomain.com
DocumentRoot /var/www/html/opencart/
ServerName opencart.yourdomain.com
<Directory /var/www/html/opencart/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/httpd/yourdomain.com-error_log
CustomLog /var/log/httpd/yourdomain.com-access_log common
</VirtualHost>
```

Save and close the file, then restart the Apache service to apply the changes:

```
systemctl restart httpd
```

## Step 5 – Configure Firewall

If you are using firewalld then you will need to allow HTTP and HTTPS services through the firewall. You can allow them using the following command:

```
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
```

Next, reload firewalld to apply the changes:

```
firewall-cmd --reload
```

## Step 6 – Access OpenCart Web UI

You can now access the OpenCart Web UI using the URL **http://opencart.yourdomain.com**. You should see the following page:
 ![OpenCart License page](https://www.atlantic.net/wp-content/uploads/2021/09/p1-4-1024x580.png)
 Accept the license agreement and click on the **Continue** button. You should see the following page:
 ![OpenCart Dependencies Check page](https://www.atlantic.net/wp-content/uploads/2021/09/p2-2-1024x571.png)
 Make sure all PHP extensions are installed then click on the **Continue** button. You should see the following page:
 ![OpenCart Database Configuration page](https://www.atlantic.net/wp-content/uploads/2021/09/p3-1-1024x559.png)
 Provide your database details, admin username, password, and click on the **Continue** button. You should see the following page:
 ![OpenCart Install finish page](https://www.atlantic.net/wp-content/uploads/2021/09/p4-1-1024x609.png)
 Now, open your terminal and remove the install directory using the following command:

```
rm -rf /var/www/html/opencart/install
```

Next, go back to the OpenCart web interface and click on **Login to your Administration**. You should see the OpenCart login page:
 ![OpenCart login page](https://www.atlantic.net/wp-content/uploads/2021/09/p6-1024x482.png)
 Provide your admin username, password and click on the **Login** button. You should see the OpenCart dashboard on the following page:
 ![OpenCart Dashboard page](https://www.atlantic.net/wp-content/uploads/2021/09/p7-1024x541.png)

## Conclusion

Congratulations! Your OpenCart platform is now ready to use. You can now deploy your own online store using OpenCart. Get started on [dedicated hosting](https://www.atlantic.net/dedicated-server-hosting/) from Atlantic.Net.
