[Yandex Cloud documentation](../../../index.md) > [Yandex Managed Service for PostgreSQL](../../index.md) > [Tutorials](../index.md) > [Creating a Joomla website with a PostgreSQL database](index.md) > Management console

# Creating a Joomla website with a PostgreSQL database from the management console

To create an infrastructure for your [Joomla website with a PostgreSQL database](index.md) from the Yandex Cloud management console:

1. [Get your cloud ready](#before-you-begin).
1. [Create and set up a cloud network](#setup-network).
1. [Create a VM for Joomla](#create-vm).
1. [Create and configure a public DNS zone](#configure-dns).
1. [Add a TLS certificate to Yandex Certificate Manager](#issue-certificate).
1. [Create a PostgreSQL DB cluster](#create-cluster).
1. [Set up your VM environment](#env-install).
1. [Configure Joomla](#configure-joomla).
1. [Test the website](#test-site).

If you no longer need the resources you created, [delete them](#clear-out).

## Get your cloud ready {#before-you-begin}

Sign up for Yandex Cloud and create a [billing account](../../../billing/concepts/billing-account.md):
1. Navigate to the [management console](https://console.yandex.cloud) and log in to Yandex Cloud or create a new account.
1. On the **[Yandex Cloud Billing](https://center.yandex.cloud/billing/accounts)** page, make sure you have a billing account linked and it has the `ACTIVE` or `TRIAL_ACTIVE` [status](../../../billing/concepts/billing-account-statuses.md). If you do not have a billing account, [create one](../../../billing/quickstart/index.md) and [link](../../../billing/operations/pin-cloud.md) a cloud to it.

If you have an active billing account, you can create or select a [folder](../../../resource-manager/concepts/resources-hierarchy.md#folder) for your infrastructure on the [cloud page](https://console.yandex.cloud/cloud).

[Learn more about clouds and folders here](../../../resource-manager/concepts/resources-hierarchy.md).


### Required paid resources {#paid-resources}

* VM instance: use of computing resources, storage, public IP address, and OS (see [Compute Cloud pricing](../../../compute/pricing.md)).
* Managed Service for PostgreSQL cluster: computing resources allocated to hosts, storage and backup size (see [Managed Service for PostgreSQL pricing](../../pricing.md)).
* Fee for outgoing traffic (see [Yandex Compute Cloud pricing](../../../compute/pricing.md)).
* Public DNS queries and [DNS zones](../../../dns/concepts/dns-zone.md) (see [Cloud DNS pricing](../../../dns/pricing.md)).


## Set up a cloud network {#setup-network}

### Create a cloud network and subnets {#create-network}

{% list tabs group=instructions %}

- Management console {#console} 

  1. Create a cloud network:

      1. In the [management console](https://console.yandex.cloud), select the folder where you are going to create your infrastructure.
      1. Navigate to **Virtual Private Cloud**.
      1. At the top right, click **Create network**.
      1. In the **Name** field, specify `joomla-network`.
      1. In the **Advanced** field, disable **Create subnets**.
      1. Click **Create network**.
  1. Create a subnet in the `ru-central1-b` [availability zone](../../../overview/concepts/geo-scope.md):

      1. In the network list window that opens, select `joomla-network` you have just created.
      1. In the top panel, click ![subnets](../../../_assets/console-icons/nodes-right.svg) **Create subnet**.
      1. In the **Name** field, specify `joomla-subnet-b`.
      1. In the **Availability zone** field, select `ru-central1-b`.
      1. In the **CIDR** field, specify `192.168.1.0/24`.
      1. Click **Create subnet**.
  1. Similarly, create subnets named `joomla-subnet-a` and `joomla-subnet-d` in the `ru-central1-a` and `ru-central1-d` availability zones, respectively. Specify `192.168.2.0/24` and `192.168.3.0/24` in the **CIDR** field for these subnets.

{% endlist %}

### Create security groups {#crete-sg}

Create `joomla-sg` and `postgresql-sg` [security groups](../../../vpc/concepts/security-groups.md) to manage network access permissions for the VM and the Yandex Managed Service for PostgreSQL cluster.

{% list tabs group=instructions %}

- Management console {#console}

  1. Create a security group named `joomla-sg` for your VM:

      1. In the [management console](https://console.yandex.cloud), select the folder where you are deploying your infrastructure.
      1. Navigate to **Virtual Private Cloud**.
      1. In the left-hand panel, select ![image](../../../_assets/console-icons/shield.svg) **Security groups** and click **Create security group**.
      1. In the **Name** field, enter `joomla-sg`.
      1. In the **Network** field, select `joomla-network` you created earlier.
      1. Under **Rules**, [create](../../../vpc/operations/security-group-add-rule.md) the following traffic management rules:

          | Traffic<br/>direction | Description | Port range | Protocol | Source /<br/>Destination name | CIDR blocks /<br/>Security group |
          | --- | --- | --- | --- | --- | --- |
          | Inbound | `http`           | `80` | `TCP` | `CIDR` | `0.0.0.0/0` |
          | Inbound | `https`            | `443`   | `TCP`  | `CIDR` | `0.0.0.0/0` |
          | Inbound | `ssh`            | `22`   | `TCP`  | `CIDR` | `0.0.0.0/0` |
          | Inbound | `self`            | `All`   | `Any`  | `Security group` | `Current` |
          | Outbound | `any`           | `All` | `Any` | `CIDR` | `0.0.0.0/0` |

      1. Click **Create**.
  1. Similarly, create a security group named `postgresql-sg` for the Managed Service for PostgreSQL cluster with the following traffic rules:

      | Traffic<br/>direction | Description | Port range | Protocol | Source /<br/>Destination name | CIDR blocks /<br/>Security group |
      | --- | --- | --- | --- | --- | --- |
      | Inbound | `port-6432`           | `6432` | `TCP` | `CIDR` | `192.168.1.0/24` |
      | Inbound | `self`            | `All`   | `TCP`  | `Security group` | `Current` |
      | Outbound | `any`           | `All` | `Any` | `CIDR` | `0.0.0.0/0` |

{% endlist %}

### Reserve a static public IP address {#reserve-ip}

Reserve a static [public IP address](../../../vpc/concepts/address.md#public-addresses) for the VM that will host your website.

{% list tabs group=instructions %}

- Management console {#console}

   1. In the [management console](https://console.yandex.cloud), select the folder where you are deploying your infrastructure.
   1. Navigate to **Virtual Private Cloud**.
   1. In the left-hand panel, select ![image](../../../_assets/console-icons/map-pin.svg) **Public IP addresses** and click **Reserve public IP address**.
   1. In the window that opens, select `ru-central1-b` in the **Availability zone** field and click ** Reserve**.

{% endlist %}

## Create a VM for Joomla {#create-vm}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), on the dashboard of the folder where you want to create your infrastructure, click ![plus](../../../_assets/console-icons/plus.svg) **Create resource** and select ![cpu](../../../_assets/console-icons/cpu.svg) `Virtual machine instance`.
  1. Under **Boot disk image**, in the **Product search** field, type `Ubuntu 24.04` and select a public [Ubuntu 24.04 LTS](https://yandex.cloud/en/marketplace/products/yc/ubuntu-24-04-lts) image.
  1. Under **Location**, select the `ru-central1-b` availability zone.
  1. Under **Network settings**:

      * In the **Subnet** field, select `joomla-network` and `joomla-subnet-b`.
      * In the **Public IP address** field, select `List` and then, the previously reserved IP address in the field that appears.
      * In the **Security groups** field, select `joomla-sg`.

  1. Under **Access**, select **SSH key** and specify the VM access credentials:

      * In the **Login** field, enter the username: `yc-user`.
      * In the **SSH key** field, select the SSH key saved in your [organization user](../../../organization/concepts/membership.md) profile.
        
        If there are no SSH keys in your profile or you want to add a new key:
        
        1. Click **Add key**.
        1. Enter a name for the SSH key.
        1. Select one of the following:
        
            * `Enter manually`: Paste the contents of the public SSH key. You need to [create](../../../compute/operations/vm-connect/ssh.md#creating-ssh-keys) an SSH key pair on your own.
            * `Load from file`: Upload the public part of the SSH key. You need to create an SSH key pair on your own.
            * `Generate key`: Automatically create an SSH key pair.
            
              When adding a new SSH key, an archive containing the key pair will be created and downloaded. In Linux or macOS-based operating systems, unpack the archive to the `/home/<user_name>/.ssh` directory. In Windows, unpack the archive to the `C:\Users\<user_name>/.ssh` directory. You do not need additionally enter the public key in the management console.
        
        1. Click **Add**.
        
        The system will add the SSH key to your organization user profile. If the organization has [disabled](../../../organization/operations/os-login-access.md) the ability for users to add SSH keys to their profiles, the added public SSH key will only be saved in the user profile inside the newly created resource.

  1. Under **General information**, specify the VM name: `joomla-web-server`.
  1. Click **Create VM**.

  It may take a few minutes to create your VM.

{% endlist %}

## Create and configure a public DNS zone {#configure-dns}

You need to link the domain name you want to use for your website to the IP address of the new `joomla-web-server` VM. You can use [Yandex Cloud DNS](../../../dns/index.md) to manage the domain.

### Delegate the domain name {#delegate-domain}

Delegation involves reassigning domain management from your registrar's servers to your own ones, which includes creating [NS](../../../dns/concepts/resource-record.md#ns) records.

To delegate a domain, specify the `ns1.yandexcloud.net` and `ns2.yandexcloud.net` DNS server addresses in the domain settings in your account on your domain registrar's website.

Delegation does not take effect immediately. Internet provider servers normally update records within 24 hours (86,400 seconds). This depends on the TTL value which specifies how long domain records are cached.

You can check domain delegation using [Whois](https://www.reg.com/whois/check_site) or the `dig` utility:

```bash
dig +short NS example.com
```

Result:

```text
ns2.yandexcloud.net.
ns1.yandexcloud.net.
```

### Create a public DNS zone {#create-zone}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the folder where you are deploying your infrastructure.
  1. Navigate to **Cloud DNS** and click **Create zone**.
  1. Specify the zone settings consistent with your domain:

      1. **Zone**: Domain zone. Its name must end with a trailing dot. For example, `example.com.` matches the `example.com` domain. To create a domain name with non-Latin characters, use the [Punycode](https://en.wikipedia.org/wiki/Punycode) encoding.
      1. **Type**: `Public`.
      1. **Name**: `joomla-zone`.

  1. Click **Create**.

{% endlist %}

### Create a type A resource record {#create-a-record}

In your DNS zone, create a [type A resource record](../../../dns/concepts/resource-record.md#a) pointing to the public IP address of the previously created VM:

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the folder where you are deploying your infrastructure.
  1. Navigate to **Cloud DNS**.
  1. Select `joomla-zone` you previously created and click **Create record**.
  1. Specify the record settings:
      1. In the **Name** field, select `Matches zone name (@)`.
      1. In the **Type** field, select the `A` [record type](../../../dns/concepts/resource-record.md#rr-types).
      1. In the **Data** field, specify the [public IP address](../../../vpc/concepts/address.md#public-addresses) of the web server VM you created earlier.

          You can find the VM IP address in the [management console](https://console.yandex.cloud), on the VM page under **Network**.

  1. Click **Create**.

{% endlist %}

## Add a TLS certificate to Yandex Certificate Manager {#issue-certificate}

Create a new Let's Encrypt® [certificate](../../../certificate-manager/concepts/managed-certificate.md) for your domain to enable secure access to your website over TLS:

1. Add the new certificate to Certificate Manager:

    {% list tabs group=instructions %}

    - Management console {#console}

      1. In the [management console](https://console.yandex.cloud), select the folder where you are deploying your infrastructure.
      1. Navigate to **Certificate Manager**.
      1. Click **Add certificate** and select `Let's Encrypt certificate`.
      1. In the window that opens, specify `joomla-cert` in the **Name** field.
      1. In the **Domains** field, specify your domain name, e.g., `example.com`.
      1. Select `DNS` as the [domain ownership verification type](../../../certificate-manager/concepts/challenges.md).
      1. Click **Create**.

    {% endlist %}

1. To successfully issue the certificate, pass a domain rights check:

    {% list tabs group=instructions %}

    - Management console {#console}

        1. In the [management console](https://console.yandex.cloud), select the folder where you are deploying your infrastructure.
        1. Navigate to **Certificate Manager**.
        1. From the list of certificates, select `joomla-cert`.
        1. In the window that opens, under **Check rights for domains**, select `CNAME record`.
        1. In the section below, click **Create record** and then, **Create** in the window that opens.

        Domain ownership verification may take from a few minutes to a few days. Wait until it successfully completes. As a result, the certificate will be issued and get the `Issued` status.

    {% endlist %}

## Create a PostgreSQL DB cluster {#create-cluster}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), on the dashboard of the folder where you are deploying your infrastructure, click ![plus](../../../_assets/console-icons/plus.svg) **Create resource** and select `PostgreSQL cluster`.
  1. In the **Cluster name** field, enter the cluster name: `joomla-pg-cluster`.
  1. In the **Version** field, select the DBMS version: `17`.
  1. Under **Host class**, select the appropriate [host](../../concepts/instance-types.md) class.
  1. Under **Storage size**, specify: `10 GB`.
  1. Under **Database**, specify:
      * **DB name**: `joomla_db`.
      * **Username**: `joomla`.
      * In the **Password** field, select `Enter manually` and set a password you will use to access the database.
  1. Under **Network settings**, select `joomla-network` and `postgresql-sg` you created previously as the network and security group, respectively.
  1. Under **Hosts**, add more hosts to have one host in each availability zone. When creating hosts, do not enable **Public access** for them.
  1. Click **Create cluster**.

  Creating a DB cluster may take a few minutes.

{% endlist %}

## Set up your VM environment {#env-install}

At this step, you will prepare the VM environment to deploy and set up Joomla.

1. Export the `joomla-cert` TLS certificate to your local computer:

    {% list tabs group=instructions %}

    - Management console {#console}

        1. In the [management console](https://console.yandex.cloud), select the folder where you are deploying your infrastructure.
        1. Navigate to **Certificate Manager** and select the `joomla-cert` certificate.
        1. In the top panel, click ![ArrowUpFromLine](../../../_assets/console-icons/arrow-up-from-line.svg) **Export certificate**, select `Certificate without private key`, and click **Download certificate**. A file with the `certificate.pem` certificate will be saved to your computer.
        1. Repeat the previous step and download the private key by selecting `Private key only`. Rename the downloaded private key file to `private_key.pem`.
        1. Save the downloaded `certificate.pem` and `private_key.pem` files: you will need them to configure the web server.

    {% endlist %}

1. Copy the certificate and private key to the VM:

    ```bash
    scp ./certificate.pem yc-user@<VM_IP_address>:certificate.pem \
      && scp ./private_key.pem yc-user@<VM_IP_address>:private_key.pem
    ```

    Where `<VM_IP_address>` is the public IP address of the previously created `joomla-web-server` VM.

    You can find the VM IP address in the [management console](https://console.yandex.cloud) on the VM page under **Network**.

    If this is your first time connecting to the VM, you will get this unknown host warning:

    ```text
    The authenticity of host '51.250.**.*** (51.250.**.***)' can't be established.
    ED25519 key fingerprint is SHA256:PpcKdcT09gjU045pkEIwIU8lAXXLpwJ6bKC********.
    This key is not known by any other names
    Are you sure you want to continue connecting (yes/no/[fingerprint])?
    ```

    Type `yes` into the terminal and press **Enter**.

1. [Connect](../../../compute/operations/vm-connect/ssh.md) to the VM over SSH:

    ```bash
    ssh yc-user@<VM_IP_address>
    ```
1. Create a directory for the certificate and move the copied files there:

    ```bash
    sudo mkdir /etc/ssl-certificates
    sudo mv certificate.pem /etc/ssl-certificates/
    sudo mv private_key.pem /etc/ssl-certificates/
    ```
1. Upgrade the versions of the packages installed on the VM:

    ```bash
    sudo apt update && sudo apt upgrade -y
    ```
1. Install and run the [Apache HTTP server](https://en.wikipedia.org/wiki/Apache_HTTP_Server):

    ```bash
    sudo apt install apache2
    sudo systemctl start apache2 && sudo systemctl enable apache2
    ```
1. Install [PHP](https://en.wikipedia.org/wiki/PHP) with the required libraries:

    ```bash
    sudo apt install php libapache2-mod-php php-common php-pgsql php-xml php-mbstring php-curl php-zip php-intl php-json unzip
    ```
1. Download and unpack the Joomla package:

    {% note info %}

    This example uses a link to Joomla `5.2.4`, the latest version at the time of writing this guide. To check for a newer version and get the download link, visit the project [website](https://downloads.joomla.org/).

    {% endnote %}

    ```bash
    wget https://downloads.joomla.org/cms/joomla5/5-2-4/Joomla_5-2-4-Stable-Full_Package.zip -O Joomla.zip
    sudo rm /var/www/html/index.html
    sudo unzip Joomla.zip -d /var/www/html
    rm Joomla.zip
    ```
1. Set up access permissions for the website directory:

    ```
    sudo chown -R www-data:www-data /var/www/html
    sudo chmod -R 755 /var/www/html
    ```
1. Change the number of the default port used by Joomla to access PostgreSQL databases: Yandex Managed Service for PostgreSQL uses port `6432`.

    1. Open the Joomla database access driver configuration file:

        ```bash
        sudo nano /var/www/html/libraries/vendor/joomla/database/src/Pdo/PdoDriver.php
        ```
    1. In the file, find the section with PostgreSQL database settings and change the port number from `5432` to `6432`:

        ```php
        ...
        case 'pgsql':
        $this->options['port'] = $this->options['port'] ?? 6432;
        ...
        ```

        Make sure to save your changes.
1. Configure a virtual host for your website:

    1. Create a virtual host configuration file:

        ```bash
        sudo nano /etc/apache2/sites-available/joomla.conf
        ```

    1. Add the following configuration into the file:

        ```text
        <VirtualHost *:80>
            ServerAdmin admin@localhost
            DocumentRoot /var/www/html
            ServerName <domain_name>

            <Directory /var/www/html>
                Options FollowSymLinks
                AllowOverride All
                Require all granted
            </Directory>

            ErrorLog ${APACHE_LOG_DIR}/joomla_http_error.log
            CustomLog ${APACHE_LOG_DIR}/joomla_http_access.log combined
        </VirtualHost>

        <VirtualHost *:443>
            ServerAdmin admin@localhost
            DocumentRoot /var/www/html
            ServerName <domain_name>

            ErrorLog ${APACHE_LOG_DIR}/joomla_ssl_error.log
            CustomLog ${APACHE_LOG_DIR}/joomla_ssl_access.log combined

            SSLEngine on
            SSLCertificateFile /etc/ssl-certificates/certificate.pem
            SSLCertificateChainFile /etc/ssl-certificates/certificate.pem
            SSLCertificateKeyFile /etc/ssl-certificates/private_key.pem
        </VirtualHost>
        ```

        Where `<domain_name>` is the domain name of your website, e.g., `example.com`.
1. Activate the virtual host and restart the web server:

    ```bash
    sudo a2ensite joomla.conf
    sudo a2enmod rewrite
    sudo a2enmod ssl
    sudo systemctl restart apache2
    ```

## Configure Joomla {#configure-joomla}

1. Get the Managed Service for PostgreSQL cluster host names (you will need them when installing Joomla):

    {% list tabs group=instructions %}

    - Management console {#console}

      1. In the [management console](https://console.yandex.cloud), select the folder containing the cluster.
      1. Navigate to **Managed Service for&nbsp;PostgreSQL**.
      1. Select the `joomla-pg-cluster` cluster and open the **Hosts** tab.
      1. Hover over the **Host FQDN** field in the row with each host and click ![Copy](../../../_assets/console-icons/copy.svg) to copy the host FQDN. Save the values you copied, as you will need them later.

    {% endlist %}

1. Install and configure Joomla:

    1. Open the Joomla setup wizard in your browser. At this step, you can access it using any of these addresses:

        * `http://<VM_public_IP_address>`
        * `http://<your_domain_name>`
        * `https://<your_domain_name>`
    1. When configuring database parameters, fill in the following fields:

        * **Database type**: `PostgreSQL (PDO)`.
        * **Host name**:

            ```text
            <host_1_name>,<host_2_name>,<host_3_name>
            ```

            Where `<host_1_name>`, `<host_2_name>`, and `<host_3_name>` are the Managed Service for PostgreSQL cluster host FQDNs you copied at the previous step.
        * **Database username**: `joomla`.
        * **Database user password**: DB user password set when creating the PostgreSQL cluster.
        * **Database name**: `joomla_db`.
        * **Connection encryption**: Keep the default value.
    1. Joomla may prompt you to create or delete a specific test file in the product installation directory on the VM for security purposes. Navigate to the `/var/www/html/installation/` directory and create or delete the specified file there:

        ```text
        You are trying to connect to a database host that is not available on 
        your local server. You need to verify ownership of the hosting 
        account. Read the information provided on the **Secure 
        installation procedure** page.

        To verify your ownership of the website, delete 
        `_JoomlazUZKusLnD2jXi********.txt` from the `installation` directory and click 
        **Install Joomla** to continue.
        ```
1. After installation is complete, delete the `installation` directory from the VM. This is a Joomla security requirement:

    ```bash
    sudo rm -rf /var/www/html/installation
    ```

If you encounter any issues while installing Joomla, use [this guide](https://docs.joomla.org/J4.x:Installing_Joomla) on the project website.

## Test the website {#test-site}

After Joomla installation is complete, enter your website’s IP address or domain name in the browser to test the site:

* `http://<VM_public_IP_address>`
* `http://example.com`
* `https://example.com`

Now you can further configure your website and add content using the Joomla admin interface and tools.

## How to delete the resources you created {#clear-out}

To stop paying for the resources you created:
1. [Delete](../../../compute/operations/vm-control/vm-delete.md) the `joomla-web-server` VM.
1. [Delete](../../../vpc/operations/address-delete.md) the static public IP address.
1. [Delete](../../operations/cluster-delete.md) the Managed Service for PostgreSQL cluster named `joomla-pg-cluster`.
1. [Delete](../../../dns/operations/resource-record-delete.md) the DNS records and then [delete](../../../dns/operations/zone-delete.md) the `joomla-zone` DNS zone.
1. [Delete](../../../certificate-manager/operations/managed/cert-delete.md) the `joomla-cert` TLS certificate.
1. [Delete](../../../vpc/operations/security-group-delete.md) the `joomla-sg` and `postgresql-sg` security groups.
1. [Delete](../../../vpc/operations/subnet-delete.md) the `joomla-subnet-a`, `joomla-subnet-b`, and `joomla-subnet-d` subnets.
1. [Delete](../../../vpc/operations/network-delete.md) the `joomla-network` cloud network.

#### Useful links {#see-also}

* [Creating a Joomla website with a PostgreSQL database using Terraform](terraform.md)