In this exercise, you configure your server to get packages from a remote DNF repository, and then update or install a package from that repository.
Outcomes
Configure a system to obtain software updates from a classroom server, and update the system to use the latest packages.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command prepares your environment and ensures that all required resources are available.
[student@workstation ~]$ lab start software-repo
Instructions
Use the ssh command to log in to the servera system as the student user.
Use the sudo -i command to switch to the root user.
[student@workstation ~]$ssh student@servera...output omitted... [student@servera ~]$sudo -i[sudo] password for student:student[root@servera ~]#
Configure the software repositories on servera to obtain custom packages and updates from the following URL:
Custom packages at http://content.example.com/rhel9.0/x86_64/rhcsa-practice/rht
Updates of the custom packages at http://content.example.com/rhel9.0/x86_64/rhcsa-practice/errata
Use the dnf config-manager command to add the custom packages repository.
[root@servera ~]#dnf config-manager \--add-repo "http://content.example.com/rhel9.0/x86_64/rhcsa-practice/rht"Adding repo from: http://content.example.com/rhel9.0/x86_64/rhcsa-practice/rht
Examine the software repository file that the previous command created in the /etc/yum.repos.d directory.
Use the vim command to edit the file, and add the gpgcheck=0 parameter to disable the GPG key check for the repository.
[root@servera ~]#vim \/etc/yum.repos.d/content.example.com_rhel9.0_x86_64_rhcsa-practice_rht.repo[content.example.com_rhel9.0_x86_64_rhcsa-practice_rht] name=created by dnf config-manager from http://content.example.com/rhel9.0/x86_64/rhcsa-practice/rht baseurl=http://content.example.com/rhel9.0/x86_64/rhcsa-practice/rht enabled=1gpgcheck=0
Create the /etc/yum.repos.d/errata.repo file to enable the updates repository with the following content:
[rht-updates] name=rht updates baseurl=http://content.example.com/rhel9.0/x86_64/rhcsa-practice/errata enabled=1 gpgcheck=0
Use the dnf repolist all command to list all repositories on the system.
[root@servera ~]#dnf repolist allrepo id repo name statuscontent.example.com_rhel9.0_x86_64_rhcsa-practice_rhtcreated by .... enabled ...output omitted...rht-updatesrht updates enabled
Disable the rht-updates software repository and install the rht-system package.
Use the dnf config-manager --disable command to disable the rht-updates repository.
[root@servera ~]# dnf config-manager --disable rht-updatesList, and then install, the rht-system package.
[root@servera ~]#dnf list rht-systemAvailable Packages rht-system.noarch 1.0.0-1 content.example.com_rhel9.0_x86_64_rhcsa-practice_rht [root@servera ~]#dnf install rht-systemDependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: rht-system noarch 1.0.0-1 content..._rht 3.7 k ...output omitted... Is this ok [y/N]:y...output omitted... Installed: rht-system-1.0.0-1.noarch Complete!
Verify that the rht-system package is installed, and note the version number of the package.
[root@servera ~]#dnf list rht-systemInstalled Packagesrht-system.noarch1.0.0-1@content.example.com_rhel9.0_x86_64_rhcsa-practice_rht
Enable the rht-updates software repository and update all relevant software packages.
Use dnf config-manager --enable to enable the rht-updates repository.
[root@servera ~]# dnf config-manager --enable rht-updatesUse the dnf update command to update all software packages on servera.
[root@servera ~]#dnf updateDependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Upgrading: rht-system noarch 1.0.0-2 rht-updates 7.5 k ...output omitted... Is this ok [y/N]:y...output omitted... Complete!
Verify that the rht-system package is upgraded, and note the version number of the package.
[root@servera ~]#dnf list rht-systemInstalled Packagesrht-system.noarch1.0.0-2@rht-updates
Exit from servera.
[root@servera ~]#exitlogout [student@servera ~]$exitlogout Connection to servera closed. [student@workstation ~]$
This concludes the section.