How to mirror the Virtuozzo Infrastructure repository

This guide describes how to deploy an HTTP server that will act as a repository mirror for Virtuozzo Infrastructure. This will allow you to manage Virtuozzo Infrastructure clusters without direct Internet access.

Creating a virtual machine

Create a virtual machine with the following parameters:

  • OS: CentOS 9 (recommended and tested) or any RPM-based OS that runs on Linux kernel 5.x
  • vCPU: 2
  • RAM: 4 GB
  • Storage: 100 GB
  • Access to https://repo.virtuozzo.com/

Connect to the virtual machine using SSH. We recommend using sudo.

Installing prerequisites

1. Install the httpd server, createrepo, reposync tools, and the xml editor:

1
# sudo yum install httpd createrepo_c yum-utils xmlstarlet -y

2. Download and copy these RPM GPG keys to the keys directory /etc/pki/rpm-gpg/:

3. Import the RPM GPG keys:

1
2
# sudo rpm --import /etc/pki/rpm-gpg/VZLINUX9_GPG_KEY
# sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-Virtuozzo-9

Configuring the repository

We will be using the following variables:

  • <REPO-NAME> is the repository name, for example: hci-6.2
  • <UPGRADE-REPO-NAME> is the name of the upgrade repository, for example: hci-7.1
  • <BUILD-NUMBER> is the build number, for example: 6.2.1-92
  • <REPOMD-BUILD-NUMBER> is the build number that will be displayed in the admin panel, for example: 6.2.1 (92)
  • <MAJOR-BUILD-NUMBER> is the major release version, for example: 6.2
  • <UPGRADE-MAJOR-BUILD-NUMBER> is the version of a major release to upgrade to, for example: 7.1
  • <HTTP-SERVER_IP-OR-DNS_NAME> is the IP address or resolvable DNS name of your mirror server

1. Create the directory structure:

1
# sudo mkdir -p /var/www/html/repos/<REPO-NAME>

2. Create the mirrorlists directory:

1
# sudo mkdir -p /var/www/html/vz-platform/mirrorlists/<MAJOR-BUILD-NUMBER>/

3. In the mirrorlists directory, create the releases-os.mirrorlist and releases-updates.mirrorlist files with the following content:

1
http://<HTTP-SERVER_IP-OR-DNS_NAME>/repos/<REPO-NAME>/

4. Synchronize the public repository to the directory <REPO-NAME>:

4.1. Create the repos directory:

1
# sudo mkdir /root/repos

4.2. Create the /root/repos/<REPO-NAME>.repo file with the following content:

1
2
3
4
5
6
[<REPO-NAME>]
name=<REPO-NAME>
baseurl=http://repo.virtuozzo.com/vz-platform/releases/<MAJOR-BUILD-NUMBER>/x86_64/os/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Virtuozzo-9
       file:///etc/pki/rpm-gpg/VZLINUX9_GPG_KEY

4.3. Synchronize the repository:

1
# sudo reposync --setopt=reposdir=/root/repos --download-metadata --gpgcheck --repoid=<REPO-NAME> -p /var/www/html/repos/<REPO-NAME> --norepopath 2>&1 | tee /root/sync.log

4.4. Create the repository metadata:

1
# sudo createrepo -q /var/www/html/repos/<REPO-NAME> --distro="cpe:/o:virtuozzohci:vz:2,hci-<REPOMD-BUILD-NUMBER>"

4.5. Place the release notes file to the repo directory:

1
# sudo curl -s http://repo.virtuozzo.com/vz-platform/releases/<MAJOR-BUILD-NUMBER>/x86_64/os/repodata/release_notes.md -o /var/www/html/repos/<REPO-NAME>/repodata/release_notes.md

4.6. Create the releases directory:

1
# sudo mkdir -p /var/www/html/vz-platform/releases/

4.7. Create the hci-registry.json file in the releases directory with the following contents:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
{
    "epoch": 1,
    "hci-registry": [
        {
            "version": "1.0",
            "registry": {
                "releases": [
                    {
                        "baseurl": "http://repo.virtuozzo.com/repos/  <UPGRADE-REPO-NAME>/",
                        "release_notes_url": "http://repo.virtuozzo.com/repos/<UPGRADE-REPO-NAME>/repodata/release_notes.md",
                        "unskippable": false
                    }
                ]
            }
        }
    ]
}

5. Adjust ownership:

1
# sudo chown -R apache:apache /var/www/html/repos

6. Restart the httpd service:

1
# sudo systemctl restart httpd

Configuring DNS

We highly recommend adding a new A record to your own DNS server:

1
repo.virtuozzo.com A <HTTP-SERVER_IP>

If you do not have your own DNS server, you can add the following record to the /etc/hosts file on all Virtuozzo Infrastructure servers:

1
<HTTP-SERVER_IP> repo.virtuozzo.com

Updating to the next major version

To update to a new major Virtuozzo Infrastructure version, repeat the step Configuring the repository.