Creating an OpenCart online store using the management console
To create an OpenCart online store using the Yandex Cloud management console:
- Prepare your cloud.
- Create a VM with the OpenCart platform.
- (Optional) Create a MySQL® DB cluster.
- Configure OpenCart.
If you no longer need the resources you created, delete them.
Prepare your cloud
Sign up for Yandex Cloud and create a billing account:
- Go to the management console
and log in to Yandex Cloud or create an account if you do not have one yet. - On the Yandex Cloud Billing
page, make sure you have a billing account linked and it has theACTIVE
orTRIAL_ACTIVE
status. If you do not have a billing account, create one.
If you have an active billing account, you can go to the cloud page
Learn more about clouds and folders.
Required paid resources
The cost of supporting an OpenCart online store infrastructure includes:
- Fee for a continuously running VM (see Yandex Compute Cloud pricing).
- Fee for using a dynamic or static public IP address (see Yandex Virtual Private Cloud pricing).
- Fee for a DB cluster if using MySQL® (see Managed Service for MySQL® pricing).
Create a VM with the OpenCart platform
The OpenCart platform and the required components, including PHP and MySQL®, will be pre-installed on the VM boot disk.
To create a VM:
-
In the management console
, select the folder to create your VM in. -
In the list of services, select Compute Cloud.
-
In the left-hand panel, select
VMs. -
Click Create VM.
-
Under Image/boot disk selection:
-
Under Location, select an availability zone to place your VM in.
-
Under Disks and file storage, configure a boot disk:
- Select the disk type:
SSD
. - Specify the disk size:
13 GB
.
- Select the disk type:
-
Under Computing resources, go to Custom and specify the following configuration:
- Platform:
Intel Ice Lake
- Guaranteed vCPU share:
20%
- vCPU:
2
- RAM:
4 GB
- Platform:
-
Under Network settings:
-
In the Subnet field, specify the ID of a subnet in the new VM’s availability zone. Alternatively, you can select a cloud network from the list.
-
Each network must have at least one subnet. If there is no subnet, create one by selecting Create subnet.
-
If you do not have a network, click Create network to create one:
- In the window that opens, specify the network name and select the folder to host the network.
- (Optional) Select the Create subnets option to automatically create subnets in all availability zones.
- Click Create network.
-
-
In the Public address field, select
Auto
to assign a random IP address from the Yandex Cloud pool, or select a static address from the list if you reserved one in advance.
-
-
Under Access, select Immutable key and specify the information required for access to the VM:
- In the Login field, enter the preferred username for the user to be created on the VM, e.g.,
ubuntu
. -
In the SSH key field, select the SSH key saved in your organization user profile.
If there are no saved SSH keys in your profile, or you want to add a new key:
- Click Add key.
- Enter a name for the SSH key.
- Upload or paste the contents of the public key file. You need to create](../../../compute/operations/vm-connect/ssh.md#creating-ssh-keys) a key pair for the SSH connection to a VM yourself.
- Click Add.
The SSH key will be added to your organization user profile.
If users cannot add SSH keys to their profiles in the organization, the added public SSH key will only be saved to the user profile of the VM being created.
- In the Login field, enter the preferred username for the user to be created on the VM, e.g.,
-
Under General information, enter the VM name, e.g.,
opencart
. The naming requirements are as follows:- The name must be from 3 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter and the last character cannot be a hyphen.
-
Click Create VM.
-
Get the public IP address of the VM: you will use it later to configure OpenCart. You can find out the public IP address in the management console. On the VM's page, go to the Network section and find the Public IPv4 address field.
If you expect a significant load on the DB or would like to use a managed DBMS service, create a DB cluster using Managed Service for MySQL®. If not, configure OpenCart.
Create a MySQL® DB cluster
Managed Service for MySQL® takes control of DBMS support and maintenance, which includes status and current activity monitoring, automatic backup, and easily configurable fault tolerance functionality.
If you do not need a cluster, skip this step and configure OpenCart.
To create a DB cluster:
-
On the folder page in the management console
, click Create resource and select MySQL® cluster. -
Specify a name for the cluster, e.g.,
opencart
. -
Under Host class, select
s2.micro
. These characteristics are enough for the system to run under a normal workload. -
Under Database, enter:
- DB name: Keep the default value,
db1
. - Username to connect to the DB: Keep the default value,
user1
. - Password for OpenCart to access the MySQL® DB.
- DB name: Keep the default value,
-
Under Hosts, change the Availability zone for the DB, if needed. To do this, click
to the right of the currently selected availability zone and select the availability zone from the drop-down list.Tip
We recommend selecting the same availability zone as when you created the VM. This reduces latency between the VM and the DB.
-
(Optional) If you want to ensure fault tolerance for the DB, add more hosts to the cluster by clicking Add host and specifying the availability zone for the host.
-
Leave the other fields unchanged.
-
Click Create cluster.
Creating a DB cluster may take a few minutes. After creating, configure OpenCart.
Configure OpenCart
-
Open the web interface of the OpenCart online store. In the browser, open
http://<VM_public_IP_address>/
. The OpenCart settings page opens. -
Read the license and click Continue.
-
Make sure that all lines with system requirements are marked with green ticks and click Continue.
-
Set up access to the DB:
Local server MySQL®Cluster Managed Service for MySQL®DB connection attributes are generated in a special file when a VM is created:
-
Log in to the created VM via SSH.
-
Switch to
sudo -i
administration mode. -
Open
default_passwords.txt
in the admin's home directory:root@opencart:~# cat default_passwords.txt MYSQL_USER=opencart MYSQL_PASS=qDbvN1R6tA6ET MYSQL_ROOT_PASS=5DiVb80l1kXVz MYSQL_DB=opencart
-
On the OpenCart setup page, in the DB section, enter the relevant data:
- Username:
MYSQL_USER
variable value. - Database:
MYSQL_DB
variable value. - Password:
MYSQL_PASS
variable value.
Leave the other fields unchanged.
- Username:
If you are using a Managed Service for MySQL® cluster, enter the required cluster attributes:
- Hostname: Enter the fully qualified domain name (FQDN) of the created DB. To find out this name:
- Open the folder page in the management console
in a new browser tab. - Go to the Managed Service for MySQL® section.
- Select the cluster you created in the table.
- Select the Hosts tab in the left menu.
- Hover over the Hostname field (for example,
rc1c-vok617m35g3dj23i
) and copy the database's FQDN by clicking .
- Open the folder page in the management console
- Username: Username (
user1
in the example). - Database: DB name (
db1
in the example). - Password: User password you specified.
Leave the other fields unchanged.
-
-
Enter the administrator's name, password, and current email address. Then click Continue.
-
A page will open to notify you that system configuration is complete. To configure the online store, click Login to your administration and enter your admin username and password.
-
When the installation is complete, log in to the VM via SSH and delete the installation files you no longer need:
user@opencart:~$ sudo -i root@opencart:~# rm -rf /var/www/opencart/install/
-
To test the home page, go to
http://<VM_public_IP_address>/
. You will see your website home page the way your online store visitors will see it.
How to delete the resources you created
To stop paying for the resources you created:
- Delete
opencart
. - If you used a MySQL® database, delete the Managed Service for MySQL® cluster (in our example, the database cluster is created under the
opencart
name).
If you reserved a static public IP address specifically for this VM:
- Select VPC in your folder.
- Go to the IP addresses tab.
- Find the required IP address, click
, and select Delete.