Configuring DVD/ISO Repositories in Rocky Linux 8 for Offline Use
Overview
To ensure the successful deployment and operation of the Swarm software platform, it is essential to install several prerequisite packages at the operating system level. These dependencies—such as libraries, utilities, and runtime environments—are not included with the Swarm application but are managed via the system's package manager (dnf, formarly yum).
In typical scenarios, Rocky Linux 8 retrieves these packages from online repositories. However, in offline or air-gapped environments, users must configure the system to use the official Rocky Linux 8 installation media (DVD or ISO file) as a local source of packages. This guide outlines the process for mounting the installation media, disabling the default internet-based repositories, and configuring dnf to utilize these local media repositories.
Prerequisites
Rocky Linux 8 Installation Media: Either the official DVD or a corresponding ISO file (e.g.,
Rocky-8.x-x86_64-dvd1.iso)Administrative Access:
rootorsudoprivileges are required to modify system configurations and mount devices
Procedure
Step 1: Mount the Installation Media
The Rocky Linux 8 installation media must be mounted to the system’s file system to access its contents.
Option A: Utilizing a Physical DVD
Insert the Rocky Linux 8 DVD into the system's optical drive.
The media may be automatically mounted, typically under:
/run/media/<username>/<DVD_Label>/If not automatically mounted, use the following commands:
sudo mkdir -p /mnt/dvd sudo mount /dev/sr0 /mnt/dvd(Replace
/dev/sr0with the appropriate device, which can be confirmed usinglsblk.)Confirm the contents:
ls /mnt/dvdYou should see directories such as
BaseOS,AppStream, andEFI.
Option B: Utilizing an ISO File
Ensure the ISO file is present on the target system's filesystem (e.g., transferred via external media). For example, the location is
/path/to/Rocky-8.x-x86_64-dvd1.iso.Create a mount point directory:
sudo mkdir -p /mnt/isoThe ISO file is mounted using the loop device:
sudo mount -o loop /path/to/Rocky-8.x-x86_64-dvd1.iso /mnt/iso(Replace
/path/to/Rocky-8.x-x86_64-dvd1.isowith the actual file path)List the contents:
ls /mnt/iso
Directories such as BaseOS, AppStream, and EFI should be visible.
For the remainder of this guide, /mnt/media will represent the generic mount point. Substitute /mnt/media with /mnt/dvd or /mnt/iso based on your chosen method.
Step 2: Disabling Default Online Repositories
To ensure dnf uses only the local media, disable the standard repository configuration files pointing to online sources. A safe approach is to move these files to a designated backup location.
Change the current directory to the repository configuration location:
cd /etc/yum.repos.d/Create a directory for storing the disabled repository files:
sudo mkdir disabled_reposMove the default Rocky Linux .repo files into the newly created backup directory.
sudo mv Rocky*.repo disabled_repos/
Adjustments may be needed in the above command if other custom .repo files are disabled.
Caution
Ensure no essential third-party repository files are moved unless a fully offline environment is intended.
This file contains:
Rocky-AppStream.repo
Rocky-BaseOS.repo
Rocky-Extras.repo
Rocky-Debuginfo.repo (if present)
Rocky-Devel.repo (if present)
Rocky-NFV.repo (if present)
Rocky-Plus.repo (if present)
Rocky-PowerTools.repo (or Rocky-CRB.repo in later 8.x versions)
Step 3: Creating a Local Repository Configuration File
A new .repo file is needed to define the local media as a package source for dnf.
Create and open a new file named local-media.repo using a text editor:
sudo nano /etc/yum.repos.d/local-media.repoInsert the following configuration into the file.
Ensure/mnt/mediais replaced with the actual mount point/mnt/dvdor/mnt/iso.[Local-BaseOS] name=Rocky Linux 8 BaseOS - Local Media baseurl=file:///mnt/media/BaseOS enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial [Local-AppStream] name=Rocky Linux 8 AppStream - Local Media baseurl=file:///mnt/media/AppStream enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rockyofficial[Local-BaseOS], [Local-AppStream]: Unique identifiers for these repository definitions.
name: Descriptive names for the repositories.
baseurl: Specifies the location of the package repositories (BaseOS and AppStream directories) on the mounted media via the file:// protocol.
enabled=1: Marks the repositories as active.
gpgcheck=1: Enforces GPG signature verification for packages.
gpgkey: Specifies the path to the Rocky Linux GPG public key file, used for signature verification. This key is typically installed during system setup and is also available on the installation media.
Save and close the text editor (in nano, press
Ctrl+X, thenY, thenEnter).
Step 4: Verify the Configuration
Clear the
dnfcache to remove outdated repository information:sudo dnf clean allList the currently enabled repositories. The output should show only the Local-BaseOS and Local-AppStream repositories defined in the previous step:
sudo dnf repolistThe expected output will resemble:
repo id repo name status Local-AppStream Rocky Linux 8 AppStream - Local Media #,### Local-BaseOS Rocky Linux 8 BaseOS - Local Media #,###(The numerical values (# and # # #) indicate the number of packages found in each repository.)
Test the package installation. For example, installing the tree package:
sudo dnf install treeThe
dnfshould successfully locate the tree package within the configured local repositories and proceed with installation without attempting network access.
Step 4: Revert to Online Repositories
To switch back to the online repositories:
Remove or disable the local media repository file:
sudo rm /etc/yum.repos.d/local-media.repoOr, edit the file and set
enabled=0for both repository sections.Restore the original repository files:
sudo mv /etc/yum.repos.d/disabled_repos/Rocky*.repo /etc/yum.repos.d/ sudo rmdir /etc/yum.repos.d/disabled_reposClean the
dnfcache and refresh the repository list:sudo dnf clean all sudo dnf repolistUnmount the installation media if no longer needed:
sudo umount /mnt/media
Substitute /mnt/dvd or /mnt/iso as appropriate.
Following these steps configures a Rocky Linux 8 system to utilize its installation media as a package source, enabling package management functionalities in offline scenarios.