Discover how to setup local Yum repository in RHEL 7 using an ISO file with our detailed guide. Step-by-step instructions and tips for efficient package management and system updates. #centlinux #linux #yum
Table of Contents
Problem Statement
rpm command serves its purpose while installing individual packages, but it will become too difficult to install packages with hierarchical dependencies. At this point we can take advantage from yum command. Unfortunately, there is no yum repository configured in RHEL 7 servers by default, and to access to public yum repositories from Red Hat Network (RHN) you are required to have an Active Red Hat Subscription. However, we can utilize the contents of RHEL 7 ISO file to create a Local Yum Repository for our network.

Setup Local Yum Repository in RHEL 7
Transfer the RHEL 7 ISO on the Server where we want to configure Local Yum Repository. I have already copied RHEL 7 ISO on the Server.
ls rhel*
Output:
rhel-server-7.0-x86_64-dvd.iso
Create a directory and mount the ISO file on that directory.
mkdir /mnt/iso
echo "/root/rhel-server-7.0-x86_64-dvd.iso /mnt/iso iso9660 defaults 0 0" >> /etc/fstab
mount -a
Output:
mount: /dev/loop0 is write-protected, mounting read-only
Now, RHEL 7 ISO has been persistently mounted at /mnt/iso. Let’s add Local Yum Repository now.
cat >> /etc/yum.repos.d/localyum.repo << EOF
[localyum]
name=localyum
baseurl=file:///mnt/iso
enabled=1
gpgcheck=0
EOF
Build cache of our yum server.
yum clean all
yum makecache
Output:
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
localyum | 4.1 kB 00:00:00
(1/4): localyum/group_gz | 134 kB 00:00:01
(2/4): localyum/filelists_db | 3.0 MB 00:00:02
(3/4): localyum/primary_db | 3.4 MB 00:00:01
(4/4): localyum/other_db | 1.3 MB 00:00:00
Metadata Cache Created
Our Local yum repository has been configured successfully. Since, we want to use this Local yum repository for other servers as well, therefore, we use an FTP Server to share this repository to other servers in network.
On-Call In Action: Site Reliability Engineering Best Practices for Building Resilient Systems
$9.99 (as of May 31, 2025 17:49 GMT +00:00 – More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Install FTP on RHEL 7
Install an FTP Server using newly configured yum repository.
yum install -y vsftpd
Start and enable vsftpd service.
systemctl start vsftpd.service
systemctl enable vsftpd.service
Allow FTP service through Linux firewall.
firewall-cmd --permanent --add-service=ftp
firewall-cmd --reload
Now create a directory in /var/ftp/pub and change the mountpoint of ISO in /etc/fstab.
cd /var/ftp/pub/
mkdir iso
sed -i 's//mnt/iso//var/ftp/pub/iso/g' /etc/fstab
umount /mnt/iso
mount -a
Output:
mount: /dev/loop0 is write-protected, mounting read-only
Change SELinux mode to permissive.
sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/sysconfig/selinux
setenforce permissive
Apple 2025 MacBook Air 13-inch Laptop with M4 chip: Built for Apple Intelligence, 13.6-inch Liquid Retina Display, 16GB Unified Memory, 512GB SSD Storage, 12MP Center Stage Camera, Touch ID; Sky Blue
$1,065.48 (as of May 31, 2025 17:49 GMT +00:00 – More infoProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on [relevant Amazon Site(s), as applicable] at the time of purchase will apply to the purchase of this product.)Configure Yum Clients
Now connect to another server and configure its yum repository.
cat >> /etc/yum.repos.d/localyum.repo << EOF
[localyum]
name=localyum
baseurl=ftp://192.168.116.11/pub/iso
enabled=1
gpgcheck=0
EOF
Rebuild yum cache.
yum clean all
yum makecache
Output:
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
localyum | 4.1 kB 00:00:00
(1/4): localyum/group_gz | 134 kB 00:00:00
(2/4): localyum/filelists_db | 3.0 MB 00:00:00
(3/4): localyum/primary_db | 3.4 MB 00:00:00
(4/4): localyum/other_db | 1.3 MB 00:00:00
Metadata Cache Created
We can now configure all RHEL 7 servers in our network to use this Local Yum Repository.
Recommended Training: Linux Administration: The Complete Linux Bootcamp in 2025 from Andrei Dumitrescu, Crystal Mind Academy

Final Thoughts
Setting up a local Yum repository in RHEL 7 using an ISO file is a smart way to streamline package management and enhance system efficiency. By following this guide, you should now have a reliable local repository that accelerates software installation and updates.
Need expert AWS and Linux system administration? From cloud architecture to server optimization, I provide reliable and efficient solutions tailored to your needs. Hire me on Fiverr today!
Simplify package management with your local Yum repository today!
Leave a Reply
You must be logged in to post a comment.