Yum Server Configuration in RHEL 9 with mounted ISO/DVD.

1. Mount the OS ISO/DVD.

[user1@pc2 ~]$ su -
Password:
[root@pc2 ~]# mount /dev/cdrom /media
mount: /media: WARNING: source write-protected, mounted read-only.
[root@pc2 ~]# df -h | grep -i media
/dev/sr0                    8.0G  8.0G     0 100% /media
[root@pc2 ~]#
[root@pc2 ~]# ls -ltr /media
total 44
dr-xr-xr-x. 1 root root  2048 Aug  5  2022 isolinux
dr-xr-xr-x. 1 root root  2048 Aug  5  2022 images
dr-xr-xr-x. 1 root root  2048 Aug  5  2022 EFI
-r--r--r--. 1 root root   103 Aug  5  2022 media.repo
dr-xr-xr-x. 1 root root  2048 Aug  5  2022 BaseOS
dr-xr-xr-x. 1 root root  2048 Aug  5  2022 AppStream
-r--r--r--. 1 root root  3682 Aug  5  2022 RPM-GPG-KEY-redhat-release
-r--r--r--. 1 root root  1669 Aug  5  2022 RPM-GPG-KEY-redhat-beta
-r--r--r--. 1 root root 18092 Aug  5  2022 GPL
-r--r--r--. 1 root root  1455 Aug  5  2022 extra_files.json
-r--r--r--. 1 root root  8154 Aug  5  2022 EULA
[root@pc2 ~]#

2. Create a Soft Link of /media folder.
Note: I am creating soft link ( /OS-Image ) just to save my disk space. You can copy the entire /media content to a folder to avoid mounting ISO/DVD again.

[root@pc2 ~]# ln -s /media /OS-Image
[root@pc2 ~]# ls -ltr /OS-Image
lrwxrwxrwx. 1 root root 6 Jul  4 09:33 /OS-Image -> /media
[root@pc2 ~]#

3. Create repo file ( media.repo) under /etc/yum.repos.d folder.

[root@pc2 ~]# vi /etc/yum.repos.d/media.repo
[RHEL9-BaseOS]
name=BaseOS
baseurl=file:///OS-Image/BaseOS
enabled=1
gpgcheck=0

[RHEL9-AppStream]
name=AppStream
baseurl=file:///OS-Image/AppStream
enabled=1
gpgcheck=0

4. Run "yum clean all" and "yum update" command.

[root@pc2 yum.repos.d]# yum clean all
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

12 files removed
[root@pc2 yum.repos.d]# yum update
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

BaseOS                                                                19 MB/s | 1.7 MB     00:00
AppStream                                                             33 MB/s | 5.8 MB     00:00
Last metadata expiration check: 0:00:02 ago on Sun 13 Jul 2025 07:47:14 IST.
Dependencies resolved.
Nothing to do.
Complete!

5. How to install rpm using YUM.
In below example i am installing vsftpd package using "yum install" command.

[root@pc2 yum.repos.d]# yum install vsftpd
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to registe                                                                                        r.

Last metadata expiration check: 0:08:30 ago on Sun 13 Jul 2025 07:47:14 IST.
Dependencies resolved.
=====================================================================================================
 Package            Architecture       Version                     Repository                   Size
=====================================================================================================
Installing:
 vsftpd             x86_64             3.0.3-49.el9                RHEL9-AppStream             173 k

Transaction Summary
=====================================================================================================
Install  1 Package

Total size: 173 k
Installed size: 348 k
Is this ok [y/N]: Y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                             1/1
  Installing       : vsftpd-3.0.3-49.el9.x86_64                                                  1/1
  Running scriptlet: vsftpd-3.0.3-49.el9.x86_64                                                  1/1
  Verifying        : vsftpd-3.0.3-49.el9.x86_64                                                  1/1
Installed products updated.

Installed:
  vsftpd-3.0.3-49.el9.x86_64

Complete!
[root@pc2 yum.repos.d]#

6. How to remove rpm using YUM.
In below example i am removing vsftpd package using "yum remove" command.

[root@pc2 yum.repos.d]# yum remove vsftpd
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Dependencies resolved.
=============================================================================================================================================================================================
 Package                                  Architecture                             Version                                          Repository                                          Size
=============================================================================================================================================================================================
Removing:
 vsftpd                                   x86_64                                   3.0.3-49.el9                                     @RHEL9-AppStream                                   348 k

Transaction Summary
=============================================================================================================================================================================================
Remove  1 Package

Freed space: 348 k
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                     1/1
  Running scriptlet: vsftpd-3.0.3-49.el9.x86_64                                                                                                                                          1/1
  Erasing          : vsftpd-3.0.3-49.el9.x86_64                                                                                                                                          1/1
  Running scriptlet: vsftpd-3.0.3-49.el9.x86_64                                                                                                                                          1/1
  Verifying        : vsftpd-3.0.3-49.el9.x86_64                                                                                                                                          1/1
Installed products updated.

Removed:
  vsftpd-3.0.3-49.el9.x86_64

Complete!
[root@pc2 yum.repos.d]#




Fore more on YUM: Click Here