RHCSA Practical Lab Series β Configuring YUM/DNF Repositories
π Lab 17: Setting Up Default Package Repositories in RHEL 9
π Objective
In this lab, you will:
β Configure YUM/DNF repositories for package management
β Set up BaseOS and AppStream repositories
β Verify repository functionality and install packages
π Step 1: Copy the Repository Configuration File
πΉ Copy an existing repository configuration file to the correct location:
[root@node2 ~]# scp root@node1:/etc/yum.repos.d/rhcsa.repo /etc/yum.repos.d/
π Explanation:
scp
β Securely transfers files between nodes./etc/yum.repos.d/
β The directory where YUM/DNF stores repository configurations.
β Check if the file was copied successfully:
[root@node2 ~]# ls /etc/yum.repos.d/
πΉ Expected Output:
rhcsa.repo redhat.repo
β
If rhcsa.repo
is listed, proceed to Step 2.
π Step 2: Manually Configure Repository Files
πΉ Open the repository configuration file:
[root@node2 ~]# vim /etc/yum.repos.d/rhcsa.repo
πΉ Ensure the file contains the following content:
[Base]
name=Base
baseurl=http://content/rhel9.0/x86_64/dvd/BaseOS
enabled=1
gpgcheck=no
[AppStream]
name=AppStream
baseurl=http://content/rhel9.0/x86_64/dvd/AppStream
enabled=1
gpgcheck=no
π Explanation:
[Base]
β Defines the BaseOS repository.[AppStream]
β Defines the AppStream repository.baseurl
β Points to the repository location.enabled=1
β Activates the repository.gpgcheck=no
β Disables GPG key verification (for testing purposes).
β
Save and exit the file (ESC + :wq
).
π Step 3: Verify Repository Configuration
πΉ Confirm that the new repositories are recognized:
[root@node2 ~]# yum repoinfo
πΉ Expected Output:
Repo-id : Base
Repo-name : BaseOS
Repo-baseurl : http://content/rhel9.0/x86_64/dvd/BaseOS
Enabled : Yes
Repo-id : AppStream
Repo-name : AppStream
Repo-baseurl : http://content/rhel9.0/x86_64/dvd/AppStream
Enabled : Yes
β If both repositories are listed, they are correctly configured.
π Step 4: Install and Test a Package
πΉ Try installing an essential package (e.g., vsftpd
for FTP server):
[root@node2 ~]# yum -y install vsftpd
π Explanation:
-y
β Automatically confirms installation.vsftpd
β The package name (from BaseOS/AppStream repositories).
β Verify the installation:
[root@node2 ~]# rpm -q vsftpd
πΉ Expected Output:
vsftpd-3.0.3-44.el9.x86_64
β If the package is installed successfully, the repository is fully functional.
π Step 5: Enable and Start the Installed Service (Optional)
πΉ Enable and start the vsftpd
service:
[root@node2 ~]# systemctl enable --now vsftpd
πΉ Check if the service is running:
[root@node2 ~]# systemctl status vsftpd
πΉ Expected Output:
β vsftpd.service - Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2024-03-25 11:00:00 UTC; 5s ago
β
If Active: running
, the FTP server is running successfully.
π Troubleshooting Tips
πΉ If the repository does not work, try clearing and updating the cache:
[root@node2 ~]# yum clean all
[root@node2 ~]# yum makecache
πΉ If the package installation fails, check for network connectivity:
[root@node2 ~]# ping -c 4 content
πΉ If the repository URL is incorrect, manually verify with curl
:
[root@node2 ~]# curl -I http://content/rhel9.0/x86_64/dvd/BaseOS
β
If a 200 OK
response is received, the URL is accessible.
β Final Summary
β Configured BaseOS and AppStream repositories
β Verified repository functionality with yum repoinfo
β Installed and tested vsftpd
to confirm package management works
β Enabled and started a service from the repository
π Next Lab: Adjusting Logical Volume Size in RHEL 9
π© Subscribe for more RHCSA exam labs and hands-on tutorials! π