Learn how to setup Local Yum Repository in RHEL 8 with our step-by-step guide. Follow detailed instructions to configure a local repository for efficient package management on your RHEL 8 system. #centlinux #linux
Table of Contents
What is a Local Yum Repository?
A Local Yum Repository is a local storage location for RPM (Red Hat Package Manager) packages and metadata used by the Yum package manager to install, update, and manage software on Red Hat-based Linux distributions like RHEL 8 (Red Hat Enterprise Linux) and CentOS. It serves as an alternative to the remote repositories provided by Red Hat or other sources on the internet.

Why Use a Local Yum Repository?
Here are several reasons why you might set up a local Yum repository:
- Offline Environments: In environments without internet access, a local repository allows you to install and update packages.
- Network Efficiency: Reduces bandwidth usage by serving packages from a local server instead of downloading them repeatedly from the internet.
- Custom Packages: Allows you to host and manage custom or third-party RPM packages that are not available in official repositories.
- Controlled Updates: Provides control over when and which packages are updated, ensuring that updates are tested before deployment.
- Internal Distribution: Facilitates the distribution of packages within an organization or to multiple servers.
How Does a Local Yum Repository Work?
A Local Yum Repository consists of:
- RPM Packages:
- The actual files that contain software and updates. These packages are the ones that will be installed or updated on your system.
- Repository Metadata:
- Information about the packages, including their versions, dependencies, and descriptions. Yum uses this metadata to resolve package dependencies and manage installations.
Recommended Training: Linux Administration: The Complete Linux Bootcamp in 2025 from Andrei Dumitrescu, Crystal Mind Academy

Components of a Local Yum Repository
- Package Directory:
- A directory where RPM packages are stored.
- Metadata Files:
- Files generated by the
createrepo
tool that include package lists, dependency information, and other data needed for package management.
- Files generated by the
- Repository Configuration:
- Configuration files that tell Yum where to find the repository and how to access it.
Problem Definition
In the latest release of Red Hat Enterprise Linux (RHEL) 8, the legacy yum (Yellowdog Updater Modifier) has been replaced by Fedora package manager i.e. dnf (Dandified yum). Although, yum command is still available for backward compatibility, but it is actually an alias that is redirecting to dnf command.
As you aware that, Red Hat Enterprise Linux (RHEL) 8 is a commercial software and we need a paid subscription to access online yum repositories to install software packages.
However, we can also configure a local yum repository of our own. So, we can conveniently install software packages on our RHEL 8 system without having a paid subscription.
In this article, we will setup Local yum Repository in RHEL 8 server.
Environment Specification
We have configured a Red hat Enterprise Linux (RHEL) 8 virtual machine with following specifications.
- CPU – 3.4 Ghz (2 cores)
- Memory – 2 GB
- Storage – 20 GB
- Hostname – rhel-8-server.example.com
- IP Address – 192.168.116.165/24
- Operating System – Red hat Enterprise Linux (RHEL) 8
Dell Optiplex 7050 SFF Desktop PC Intel i7-7700 4-Cores 3.60GHz 32GB DDR4 1TB SSD WiFi BT HDMI Duel Monitor Support Windows 10 Pro Excellent Condition(Renewed)
13% OffSetup Local Yum Repository in RHEL 8
Copy RHEL 8 ISO file to our rhel-8-server.example.com.
ls
Output:
anaconda-ks.cfg rhel-8.0-x86_64-dvd.iso
Create a directory to mount rhel-8.0-x86_64-dvd.iso file.
mkdir /mnt/iso
Persistently mount rhel-8.0-x86_64-dvd.iso at /mnt/iso directory.
echo "/root/rhel-8.0-x86_64-dvd.iso /mnt/iso iso9660 defaults 0 0" >> /etc/fstab
mount -a
Output:
mount: /mnt/iso: WARNING: device write-protected, mounted read-only.
In RHEL 8, the yum repository has been divided into two parts.
- BaseOS – It provides the parts of the distribution that give you a running userspace on physical hardware, a virtual machine, a cloud instance or a container.
- AppStream – It provides all the applications you might want to run in a given userspace.
Add BaseOS section for our local yum repository.
cat > /etc/yum.repos.d/localyum.repo << EOF
[localyum_BaseOS]
name=localyum_BaseOS
baseurl=file:///mnt/iso/BaseOS
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
EOF
Add AppStream section for our local yum repository.
cat >> /etc/yum.repos.d/localyum.repo << EOF
[localyum_AppStream]
name=localyum_AppStream
baseurl=file:///mnt/iso/AppStream
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
EOF
Build cache for our local yum repository.
dnf makecache
Output:
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
localyum_AppStream 13 MB/s | 5.3 MB 00:00
localyum_BaseOS 13 MB/s | 2.2 MB 00:00
Metadata cache created.
Install Apache HTTP Server using dnf command.
dnf install -y httpd
Our local yum repository is working fine. Now, we are going to share the same local yum repository to our network RHEL 8 clients.
For this purpose, we required Apache HTTP server (that we have installed already) and a couple of amendments in configurations of our local yum repository.
Put SELinux in permissive mode, so we can mount the ISO file in /var/www/html and the same can be accessible by the network clients.
sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/sysconfig/selinux
setenforce permissive
Enable and start Apache HTTP Service.
systemctl enable httpd.service
systemctl start httpd.service
Allow HTTP service in Linux firewall.
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
Create a directory in /var/www/html to mount RHEL 8 ISO.
mkdir /var/www/html/rhel8
Edit /etc/fstab file to change the mount point of /dev/cdrom.
/root/rhel-8.0-x86_64-dvd.iso /var/www/html/rhel8 iso9660 defaults 0 0
Remount the ISO file.
mount -a
Output:
mount: /var/www/html/rhel8: WARNING: device write-protected, mounted read-only.
Edit localyum.repo file and update baseurls as follows.
[localyum_BaseOS]
name=localyum_BaseOS
baseurl=http://192.168.116.165/rhel8/BaseOS
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[localyum_AppStream]
name=localyum_AppStream
baseurl=http://192.168.116.165/rhel8/AppStream
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Rebuild yum cache.
dnf clean all
dnf makecache
Output:
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
12 files removed
Updating Subscription Management repositories.
Unable to read consumer identity This system is not registered to Red Hat Subscription Management.
You can use subscription-manager to register.
localyum_AppStream 24 MB/s | 5.3 MB 00:00
localyum_BaseOS 76 MB/s | 2.2 MB 00:00
Metadata cache created.
Check list of repositories on our RHEL 8 server.
dnf repolist
Output:
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:22:17 ago on Fri 05 Jul 2019 12:51:12 AM PKT.
repo id repo name status
localyum_AppStream localyum_AppStream 4,672
localyum_BaseO localyum_BaseOS 1,658
Linux Basics for Hackers: Getting Started with Networking, Scripting, and Security in Kali
Now retrieving the price.
(as of May 28, 2025 17:31 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.)Final Thoughts
Setting up a local YUM repository on RHEL 8 provides greater control over package management, improves installation speeds, and ensures system reliability even in restricted or offline environments. In this guide, we covered creating a repository, configuring the server, and setting up client access.
With your local repository now in place, you can efficiently manage software updates and installations across multiple systems. To maintain a secure and up-to-date repository, remember to regularly synchronize it with official sources and implement proper access controls.
Need a dependable Linux system administrator? I specialize in managing, optimizing, and securing Linux servers to keep your operations running flawlessly. Check out my services on Fiverr!
Leave a Reply
You must be logged in to post a comment.