OpenCart online shop

OpenCart is a platform where you can create your own online store. The platform is free and open-source. With OpenCart, you can create an online store of any complexity using a wide selection of community-supported extensions.

In this guide, you create and configure an online store built on OpenCart. To do this, you deploy a VM with the pre-installed OpenCart platform and the programs it needs to run, specifically the MySQL server.

This scenario describes how to configure a local MySQL server and deploy a Managed Service for MySQL database cluster if your local DBMS doesn't offer high enough performance or functionality. If you don't need a cluster, skip this step.

To set up your online store on OpenCart:

  1. Before you start
  2. Create a VM with the OpenCart platform
  3. (optional) Create a MySQL DB cluster
  4. Configure OpenCart

Before you start

Before deploying the server, sign in to Yandex.Cloud and create a billing account:

  1. Go to the management console. Then log in to Yandex.Cloud or sign up if don't already have an account.
  2. On the billing page, make sure you linked a billing account, and it has the ACTIVE or TRIAL_ACTIVE status. If you don't have a billing account, create one.

If you have an active billing account, you can create or select a folder to run your VM in. Go to the Yandex.Cloud home page and select or create a folder where you want to create a VM for your server. Learn more about the resource hierarchy in Yandex.Cloud.

Required paid resources

The infrastructure support cost for OpenCart includes:

Create a VM with the OpenCart platform

To create a VM:

  1. On the folder page in the management console, click Create resource and select Virtual machine.

  2. In the Name field, enter a name for the VM, such as opencart.

    • The name must be unique within the folder.
    • The name may contain lowercase Latin letters, numbers, and hyphens.
    • The first character must be a letter. The last character can't be a hyphen.
    • The maximum length of the name is 63 characters.
  3. Select the availability zone to host the VM in.

  4. Under Public images, click Select. Select a public OpenCart image.

    The OpenCart platform and the necessary components, including PHP and MySQL, are pre-installed on the boot disk.

  5. Under Disks, select an SSD with 13 GB.

  6. Under Computing resources, specify the following configuration:

    • Platform: Intel Cascade Lake.
    • Guaranteed vCPU share: 20%.
    • vCPU: 2.
    • RAM: 4 GB.
  7. Under Network settings:

    • Select the network and subnet to connect the VM to. If you don't have a network or subnet yet, you can create them on the VM creation page: click Create new network or Create new subnet.
    • In the Public address field, leave the Auto value to assign a random external IP address from the Yandex.Cloud pool, or select a static address from the list if you reserved one in advance.
  8. Under Access, specify the information required to access the virtual machine:

    • In the Login field, enter your preferred username to be created on the VM, for example, ubuntu.
    • In the SSH key field, paste your public SSH key. You need to create a key pair for the SSH connection yourself. Learn how to connect to VMs via SSH.
  9. Click Create VM.

Create the database cluster MySQL

If you expect a significant load on the database or would like to use a managed DBMS service, deploy the DB cluster using Managed Service for MySQL. The service takes control of DBMS support and maintenance. In other words, it monitors the status and current activity and enables automatic backup and easily configurable fault tolerance functionality.

To create a database cluster:

  1. On the folder page in the management console, click Create resource and select MySQL cluster.

  2. Specify a name for the cluster, such as opencart.

  3. Under Host class, select s2.micro. These characteristics are enough for the system to run under a normal workload.

  4. Under Database, enter:

    • DB name: Leave the default value, db1.
    • Username to connect to the database: Leave the default value, user1.
    • Password for OpenCart to use to access the MySQL database.
  5. Under Hosts, change the Availability zone for the database. To do this, click pencil to the right of the currently selected availability zone, and select the availability zone from the drop-down list.


    We recommend selecting the same availability zone as when you created the VM. This reduces latency between the VM and database.

  6. (optional) If you want to ensure fault tolerance for the database, add additional hosts to the cluster by clicking Add host and specify the availability zone for the host.

  7. Leave the other fields as they are.

  8. Click Create cluster.

Creating the DB cluster may take several minutes.

Configure OpenCart

  1. Open the web interface of the OpenCart online store. To do this, open the address http://<VM-public-IP-address>/ in the browser. The OpenCart settings page opens.

  2. Read the license and click Continue.

    Step 1

  3. Make sure that all the lines with system requirements are marked green and click Continue.

    Step 2

  4. Configure database access:

    1. Log in to the created VM via SSH.

    2. Switch to sudo -i administration mode.

    3. Open default_passwords.txt in the admin's home directory:

      root@opencart:~# cat default_passwords.txt
    4. In the OpenCart settings page database section, enter the relevant data:

      • Username: The MYSQL_USER variable value.
      • Database: The MYSQL_DB variable value.
      • Password: The MYSQL_PASS variable value. Leave the other fields as they are.
    • Cluster Managed Service for MySQL

      If you're using a Managed Service for MySQL cluster, enter the required cluster attributes:

      • Hostname: Enter the Fully Qualified Domain Name (FQDN) of the created database. To find it:
        1. Open the management console folder page in a new browser tab.
        2. Go to the section Managed Service for MySQL.
        3. Select the cluster you created in the table.
        4. Select the Hosts tab in the left menu.
        5. Move the cursor to the Hostname field (for example, rc1c-vok617m35g3dj23i) and copy the full database domain name by clicking the icon copy.
      • Username: The username (user1 in the example).
      • Database: The DB name (db1 in the example).
      • Password: The user password you specified. Leave the other fields as they are.
  5. Enter the administrator's name, their password, and current email address. Then click Continue.

    Step 3

  6. A page opens notifying you that the system configuration is complete. To set up the online store, click Login to your administration and enter your admin username and password.

    Step 4

  7. When the installation is complete, log in to the VM via SSH and delete the installation files you don't need anymore:

    user@opencart:~$ sudo -i
    root@opencart:~# rm -rf /var/www/opencart/install/
  8. To check the home page, go to http://<VM-public-IP-address>/. You see the home page of your website as users visiting your online store see it.

    Step 5

How to delete created resources

To stop paying for your deployed server, you need to delete your virtual machine and database cluster (if you created one):

If you reserved a static public IP address specifically for this VM:

  1. Open the Virtual Private Cloud in your folder.
  2. Go to the IP addresses tab.
  3. Find the address you need, click ellipsis, and select Delete.