Chapter #15: Setup Local HTTP YUM/DNF Repository
In this chapter, youβll learn how to create a local YUM/DNF repository on RHEL 9 using an ISO file and serve it over HTTP with Nginx, allowing offline package installations.

A software repository or βrepoβ is a central location for keeping and maintaining RPM software packages for Redhat Linux distribution, from which users can download and install packages on their Linux servers.
Repositories are generally stored on a public network, which can be accessed by multiple users on the internet. However, you can create your own local repository on your server and access it as a single user or allow access to other machines on your local LAN (Local Area Network) using an HTTP web server.
The advantage of creating a local repository is that you donβt require an internet connection to install software packages or updates.
YUM (Yellowdog Updater Modified) or DNF (Dandified YUM) is a widely used software package management utility for RPM (RedHat Package Manager) based Linux systems, which makes software installation easy on Red Hat/CentOS Linux.
In this chapter, we will explain how to set up a local YUM/DNF repository on RHEL using the installation DVD or ISO file. We will also show you how to find and install software packages on client RHEL machines using the Nginx HTTP server.
Our Testing Environment:
- Local Repository Server: RHEL 9 [192.168.0.106]
- Local Client Machine: RHEL 9 [192.168.0.200]
Install Nginx Web Server
First, install the Nginx HTTP server using the DNF package manager as follows.
dnf install nginx

Once Nginx is installed, you can start, enable the service to auto-start at boot time, and verify the status using the following commands.
systemctl start nginx
systemctl enable nginx
systemctl status nginx

Next, you need to open Nginx ports 80 and 443 on your firewall.
firewall-cmd --zone=public --permanent --add-service=http
firewall-cmd --zone=public --permanent --add-service=https
firewall-cmd --reload
Now you can verify that your Nginx server is up and running by going to the following URL in your web browser. A default Nginx web page will be displayed.
http://SERVER_DOMAIN_NAME_OR_IP

Mounting RHEL Installation DVD/ISO File
First, download the RHEL installation DVD ISO image, then create a local repository mount point under the Nginx document root directory /var/www/html/
and mount the downloaded RHEL DVD ISO image under /mnt
directory.
mkdir /var/www/html/local_repo
mount -o loop rhel-10.0-x86_64-dvd.iso /mnt [Mount ISO File]
mount /dev/cdrom /mnt
Next, copy the ISO files locally under /var/www/html/local_repo
directory and verify the contents using ls
command.
cd /mnt
tar cvf - . | (cd /var/www/html/local_repo/; tar xvf -)
ls -l /var/www/html/local_repo/

Note: If you're using SELinux in enforcing mode, make sure to allow Nginx to serve the new directory:
chcon -R -t httpd_sys_content_t /var/www/html/local_repo