Imagine that you are creating a web server for practicing purposes using CentOS or RHEL 7, once you finished installing the OS, assigning an IP, changing the hostname, blah blah blah, and more blah, you go straight to the httpd package download and installation using YUM and guest what…? you receive the following message:

Don’t panic!!! this is something that can be fixed in a few steps.

In the case of CentOS, it comes with several repositories configured and as We are so got used to just install the OS and start downloading packages you probably forgot that these repositories need internet access. As for RHEL, you will need a valid subscription in order to access to their repositories and download packages, but guess what..? I will show you how to create your own local yum repository using the same ISO/DVD you used for the OS installation.

Some of us (including myself), create this type of lab environment within a separated network without internet access and oh boy… it gets really bad when you try to install a package, You download the .rpm or src.rpm file, try to install but where are the dependencies???, trust me, it gets really really bad.

But anyway, lets put our hands to work,

First of all, you’ll need to make sure that you iso is mapped ( in the case of a VM), or the DVD or USB dongle if using a physical equipment, I am using a VM on VMware Workstation, make sure that the ISO appears as Connected, I have also the option Connect at power on checked just to make sure my ISO will be mapped once the server has been removed.

Mapping is not the same as mounting, in the case of having a minimal installation (in this case), the ISO will be mapped and available for mounting (/dev/sr0).

Let’s start by creating a folder where We’ll be copying the files from the ISO. I recommend this method since you would not be depending on the iso anymore but will be occupying some space in the OS, the folder will be called: local_repo and will be under the /media folder

$sudo mkdir /media/local_repo

Next mapping the ISO through its device (/dev/sr0), I will use the folder /tmp as a mount point

Making sure is not mounted by running

$ df


Mount the iso using the following command

$sudo mount /dev/sr0 /tmp

Confirm that the device has been mounted with the df command

Once mounted, We’ll proceed with copying the information from the mount point to our local repository folder

$ sudo cp -rf /tmp/* /media/local_repo

Time to create our local repository file, in CentOS/REHL the repository files can be found under /etc/yum.repos.d/ folder, go there using the cd command and list what’s inside that folder, in CentOS, you will find a lot of .repo files corresponding to the CentOS repositories, remember that this was the ones that did not work for us due to our lack of internet access.

$cd /etc/yum.repos.d/


At this point, We need to create our own local repo in order to install the packages available in the ISO,

Important to remember that the ISO has tons of available packages that can be used for installing if a CD/local repo is configured, when We are on the installation screen we have the chance  to select what type of installation we want, according to that, the packages will be taken from the DVD/ISO.

Delete those unnecessary files in this folder, (which will be all of them).

$ sudo rm -rf *

Create a file called: local.repo, I use VI as my default text editor, use your favorite one.

We will need to declare the following values:

repo id = Repository identity, keep in mind that his value goes between [] and you cannot use spaces between words, I recommend you to use _

repo name =  Any name you would like to set

baseurl= location of the files, in this case /media/local_repo – When locally the syntaxis will be baseurl=file:///<path-to-files>   When remote baseurl=http://<path-or-url-to.files>

enabled = 1 for yes, 0 for no

gpgcheck = checks for gpg key signature check, for this purpose it will set to 0 as no.

gpgkey =  no needed, in the case that is needed, you will need to specify the path where the rpm-gpg-key is located, whether if locally or remote.

Ours will be like this:


name = Local


gpgchek= 0


Save and exit.

The result will be:

Time to test our new local repository by making a yum makecache, this command is useful if you want to make sure that the cache is fully up to date with all metadata. This will list the current repositories available (Local).

$ sudo yum makecache

$sudo yum repolist



And finally, proceed with the download and installation of our so desired httpd package.

$ sudo yum install httpd

And that’s it, wasn’t hard was it?, from now on you will not need the use of an external repository if you need something that can be found in the installation ISO, also gives you the flexibility of installing the package’s dependencies as well.

Creating your own local yum repository gives you more options on how to manage packages on your CentOS/Redhat system even without paid RHN subscription.


Buy me a coffeeBuy me a coffee