Mount an ISO File in Linux and Create a Local Package Repository
Problem Overview
- In many environments, Linux servers do not have direct internet access due to security restrictions or network policies. Installing or updating packages in such systems becomes difficult when online repositories are unavailable.
- To solve this, Linux provides a way to mount an ISO image locally and use it as a local package repository. This approach is commonly used for:
- Offline servers
- Air-gapped environments
- Faster package installations
- Consistent package versions across systems
- By creating a local repository from an ISO file, package management tools can install software without relying on external networks.
Prerequisites
Before creating a local repository from an ISO file, ensure the following:
- Root or sudo access on the system
- ISO file of the Linux distribution available locally
- Sufficient disk space for mounting
- System running a supported Linux distribution
Solution
Copy the required RHEL ISO file to the Linux system where the local repository will be configured.
[root@pythonlinuxhub ~]# cd /home/pythonlinuxhub/ [root@pythonlinuxhub pythonlinuxhub]# ls -lrth total 13G -rw-r--r--. 1 pythonlinuxhub pythonlinuxhub 13G Jan 6 00:11 rhel-9.7-x86_64-dvd.iso
Mount the ISO file to a directory using a loop device so it behaves like installation media.
[root@pythonlinuxhub pythonlinuxhub]# mkdir -p /mnt/disc [root@pythonlinuxhub pythonlinuxhub]# mount -o loop rhel-9.7-x86_64-dvd.iso /mnt/disc mount: /mnt/disc: WARNING: source write-protected, mounted read-only.
Create a repository file named
rhel9.repoinside/etc/yum.repos.d/and configure it to point to the mounted ISO path.[root@pythonlinuxhub pythonlinuxhub]# cd /etc/yum.repos.d/ [root@pythonlinuxhub yum.repos.d]# cat rhel9.repo [BaseOS] name=BaseOS Packages Red Hat Enterprise Linux 9 metadata_expire=-1 gpgcheck=0 enabled=1 baseurl=file:///mnt/disc/BaseOS/ [AppStream] name=AppStream Packages Red Hat Enterprise Linux 9 metadata_expire=-1 gpgcheck=0 enabled=1 baseurl=file:///mnt/disc/AppStream/
Clear existifng package manager cache and refresh repository metadata to load the new local repository.
[root@pythonlinuxhub 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 "rhc" or "subscription-manager" to register. 0 files removed [root@pythonlinuxhub yum.repos.d]# yum repolist Updating Subscription Management repositories. Unable to read consumer identity This system is not registered with an entitlement server. You can use "rhc" or "subscription-manager" to register. repo id repo name AppStream AppStream Packages Red Hat Enterprise Linux 9 BaseOS BaseOS Packages Red Hat Enterprise Linux 9
Validate the setup by installing the
httpdpackage from the newly created local repository.[root@pythonlinuxhub yum.repos.d]# yum install -y httpd
Shaik Mohammed Faruk
Software Engineer sharing practical tutorials and insights on Linux, Python, SQL, and modern technologies.
Read more About Me

Honestly, the variety of games here is insane. I spent the whole weekend exploring and I’m impressed by the stability. Highly recommend uk999game to anyone looking for some real fun.
Honestly one of the smoothest apps I have tried lately. Fast payouts and the interface is very friendly for beginners. Definitely check out phtg7776 if you want a fair game.
Everything is just so seamless here. I appreciate the transparency and the easy navigation. Go check bdap999 out.
The interface is so intuitive and the bonuses are actually fair. I had a few questions and the support team replied almost instantly. Highly recommend idlogam88 to everyone.
Great experience so far. The gameplay is lag-free and the graphics are top notch. If you are looking for excitement, pk21pk is the place to be.
Finally found a platform that doesn’t lag during peak hours. The game variety is top notch and easy to navigate. pkwinpkr888
The slot variety is insane! I spent hours trying different games and they all look stunning. Big wins are actually possible at jilicashslot
I’ve been playing here for a few weeks now and the interface is super smooth. Really enjoying the variety of games available. Check out vngamef188 for a great experience!
Love the variety of games here. I had a great run last night and the withdrawal was processed almost instantly. Check out brbbcwin for some real excitement.
The app version is a game changer. It is so much more convenient to bet on the go without any glitches. Highly recommend downloading br393betapk