Purpose
In certain cases, the cluster cannot access the Internet directly, or having a local repository within the company intranet may be beneficial, e.g., when a site is hosting multiple clusters. This KB article will describe creating a local repository using the head node’s web server when running a Red Hat distribution such as RHEL or Rocky Linux. The same steps will generally work if you want to host a repository on a third-party server, rather than the head node.
NOTE: This is also covered in the Administrator Manual, in the chapter on post-installation software management, in the section titled: Configuring Local Repositories For Linux Distributions, And For The BCM Package Repository, For A Software Image.
Steps
Make packages available
The first step is to create a directory /var/www/html/
to contain the packages you want to make available. This will use the existing head node web server to provide the files. For example, create /var/www/html/repos
:
# mkdir /var/www/html/repos
We now need to put packages into this directory. Two common ways to obtain packages are to copy the installer ISO packages or mirror a remote repository.
Option 1: Copy ISO Packages
To copy the installer ISO packages, mount a copy of the installer ISO locally and copy the packages to the newly created directory. For example:
# mkdir /mnt/iso # mount bcm-10.0-ubuntu2204.iso /mnt/iso # cp -r /mnt/iso/data/packages/ /var/www/html/repos/
NOTE: This will copy all the ISO packages to your local head node repository. You can specify a direct path to only copy specific architectures or packages as desired, instead of the broader/mnt/iso/data/packages
, e.g., /mnt/iso/data/packages/dist/<rhel|rocky>/version/
.
Option 2: Mirror a Remote Repository
1. To mirror a remote repository, createrepo and reposync are suggested (but not officially endorsed) tools. You can install these tools via the dnf package manager:
# dnf check updater; dnf install yum-utils createrepo -y
2. After these packages are installed, you can use the reposync tool to download the remote repository, specifying the --repoid
of the repository you want to mirror and the --download_path
to your local directory
# reposync --repoid=<remote_repo_id> --download_path=/var/www/html/repos/ --download-metadata --newest-only
3. After the reposync command runs, you must generate the necessary metadata for the local repository using createrepo
. This allows clients to install packages from your mirror.
# createrepo /var/www/html/repos/
Add Repo to Clients
You can now create a new repository (for example, local.repo
) file in /etc/yum.repos.d
on systems where you want to use the new repository.
[local-repo]name=BCM ISO Repo baseurl=http://<mirror_server_ip_or_hostname>/repos/ enabled=1 gpgcheck=0
To use your new repository in software images, connect to the software image chroot with the command cm-chroot-sw-img
:
# cm-chroot-sw-img /cm/images/<image name>
Afterward, create a new repository (for example, local.repo
) file in /etc/yum.repos.d
as well.
Verify ISO
To verify that the newly configured dnf repository is usable, first clean up the dnf cache and run dnf repolist:
# dnf clean all
# dnf repolist
[...]
local-repo BCM ISO Repo
[...]
You should now be able to use your new repository to install packages.