Setting up a Repository Access

Importance of Setting Up a Repository

  • Setting up a repository is crucial because:

    • On the exam, there may be no repository access available by default.

    • The exam operates in a disconnected environment, necessitating local configurations.

Definition of a Repository

  • A repository is defined as:

    • A collection of RPM (Red Hat Package Manager) packages.

    • Each repository contains an index that details the contents of that repository.

    • Repositories can be hosted through websites or created locally on a machine.

Use of DNF Command

  • DNF Command (Dandified YUM):

    • Default command used in current RHEL (Red Hat Enterprise Linux) for managing packages from repositories.

    • It is an improvement above YUM (Yellowdog Updater, Modified), which was used in earlier RHEL versions.

    • DNF and YUM provide the same core functionalities but with enhanced performance in DNF.

Subscription Manager

  • The Subscription Manager is essential for accessing online Red Hat repositories:

    • To access these repositories, the RHEL system must be registered through the Subscription Manager.

    • Access requires an active subscription, which can be a developer subscription.

    • On the exam, the system operates in a completely disconnected setup, making it impossible to connect to Red Hat repositories directly.

  • Alternatives exist:

    • Red Hat Satellite can serve as a repository when no Internet access is available.

    • Without both Internet connection and Red Hat Satellite, manual configuration of repository access is necessary.

GPG Keys and Package Signing

  • GPG (GNU Privacy Guard) Keys:

    • GPG is an open-source alternative to PGP (Pretty Good Privacy).

    • The GPG key is used to sign all package contents before installation to ensure authenticity and integrity.

    • The signature of the package is checked against the local GPG key before the installation.

  • GPG Check Option:

    • For easier access to trusted repositories during the exam, setting gpgcheck=0 in the repository client file is acceptable.

    • For online repositories, GPG keys are automatically fetched upon the first contact if the repository is GPG signed.

    • In manual setups, obtaining GPG keys might not be feasible, necessitating conservative settings in the configurations.

Manually Configuring Repository Access

  • Adding Repository Access via DNF:

    • To enable access to repositories through Subscription Manager:

    • Use command: dnf config-manager --enable <repository_name>.

    • For third-party repositories, you can use:

    • A .repo file located in /etc/yum.repos.d/, or

    • DNF config manager commands.

  • Example Command for Local Repository Access:

    • Command: dnf config-manager --add-repo=file:///repo/appstream

    • This command points to a repository present in the local file system.

    • Structure of the URL indicates where the repository is found: file:///repo/appstream.

  • Manual Creation of Repository File:

    • Create a file within /etc/yum.repos.d/ with the following structure:

    • Label: [repo_name]

    • name: Repository name

    • baseurl: Location of the repository

    • Must use three slashes (///) not two, and gpgcheck=0 to disable GPG checking.

Challenges of Exam Environment

  • Potential exam challenge:

    • Information provided on how to access a repository server will most likely be from a locally installed server.

    • Generally, the URL to access the repository will be HTTP-based.

  • Issues with Standalone Demo Environment:

    • Users will need to set up their own repository server in a disconnected environment.

    • The current demonstration focuses on configuring the installation disk as a repository.

Setting Up a Local Repository Server

  • Check Disk Space:

    • Verify at least 10 GB in the root directory:

    • Use command: df -h

  • Preferable procedure:

    • Reinstall the virtual machine on a 20 GB disk for optimal space.

  • Clone Optical Disk:

    • Command: dd if=/dev/sr0 of=rel10.iso bs=1M

    • This copies the optical disk to an ISO file named rel10.iso.

    • If the message "no medium found" appears, ensure the optical disk device is connected (via VMware or other virtualization software).

  • Mounting the ISO File:

    • Mount the created ISO file in the /repo directory:

    • Modify /etc/fstab to include:

      • rel10.iso /repo iso9660 defaults 0 0

    • Important to use double redirection to prevent overwriting the file.

  • Use mount -a to mount everything that has not been previously mounted, which populates the /repo directory with necessary files.

Fallback Procedure if Less Space is Available

  • If less than 10 GB is available:

    • Command: mknod /repo (create mount point)

    • Ensure /etc/fstab contains:

    • dev/sr0 /repo iso9660 defaults 0 0

    • Mount with: mount -a

  • Caution with this approach due to potential disconnection issues with the optical disk. Better to ensure 10 GB availability.

Setting Up Repository Access for Client

  • After setting up the repository server:

    • Command to configure the repository client:

    • dnf config-manager --add-repo=file:///repo/baseos

    • Edit repository files:

    • Open etc/yum.repos.d/repo_baseos.repo using Vim.

    • Set gpgcheck=0 to avoid signature verification errors.

  • Repeat for the AppStream repository:

    • dnf config-manager --add-repo=file:///repo/appstream

    • Edit the respective .repo file to add gpgcheck=0.

Testing the Configuration

  • Verify successful configuration by attempting to install a package:

    • Example command: dnf install m (where 'm' is a received package).

    • Check output on repository information and total download size.

    • Confirm installation was successful due to previously configured repository access.

Conclusion

  • Following these steps allows successful configuration of repository access in a disconnected environment, critical for exam scenarios.