Howto Setup yum repositories to update or install package from ISO CDROM Image

yum (Yellow dog Updater Modified) is a package manager for RPM compatible Linux systems such as CentOS, Fedora core and latest Redhat Enterprise Linux.

So how do you use yum to update / install packages from an ISO of CentOS / FC / RHEL CD?

Creation of yum repositories is handled by a separate tool called createrepo, which generates the necessary XML metadata. If you have a slow internet connection or collection of all downloaded ISO images, use this hack to install rpms from iso images.

Step # 1: Mount an ISO file

Type the following command (replace iso file name with the actual iso file):
# yum install createrepo
# mkdir -p /mnt/iso/{1,2,3}
# mount -o loop /path/to/centos1.iso /mnt/iso/1

Step # 2: Create a repository

Use createrepo to generate the necessary XML metadata. Type the following commands:
# cd /mnt/iso
# createrepo .

Clean repo, enter:
# yum clean all

Step # 3: Create config file

You need to create a repo config file in /etc/yum.repos.d/ directory.
# vi /etc/yum.repos.d/iso.repo
Append following text:
[My ISO Repository] baseurl=file:///mnt/iso

Save and close the changes.

Now use yum command to install packages from ISO images:
# yum install package-name

🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
52 comments… add one
  • Deepak Jul 12, 2016 @ 8:09

    Thanks , steps working good , but after than when i am trying to install yum install getting issue (This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.)
    sharing with you rhel release vesrion(Red Hat Enterprise Linux Server release 6.5 (Santiago)) ,so that i can expect accurate reply or comment .

  • Deepak Jul 12, 2016 @ 8:05

    Thanks , steps working good , but after than when i am trying to install yum install getting issue

    sharing with you rhel release vesrion ([root@NVMBD2BXZ090D00 /]# cat /etc/redhat-release
    Red Hat Enterprise Linux Server release 6.5 (Santiago)
    )so that i can get accurate your reply .


  • test Mar 14, 2016 @ 6:34

    I am getting this error:

    Configuration file /etc/yum/pluginconf.d/fastestmirror.conf not found
    Unable to find configuration file for plugin fastestmirror
    There are no enabled repos.
    Run “yum repolist all” to see the repos you have.
    You can enable repos with yum-config-manager –enable

    Please help

  • chrisy Sep 30, 2014 @ 3:26

    I have created a correct iso.repo file. However, I got error saying Cannot retrieve repository metadata (repomd.xml) for repository: iso-repository. Please verify its path and try again
    How to fix this issue?

  • Kelly Oct 1, 2013 @ 20:32

    Okay, now how do I back this out, and make the default way work again? I’ve backed out all the things above (at least, I think I have), done a “yum clean all,” and now when trying to use yum to go to the CentOS repositories over the Internet I get the following error:

    # yum install gcc
    Loaded plugins: fastestmirror, refresh-packagekit, security
    Determining fastest mirrors
    Could not retrieve mirrorlist error was
    14: Peer cert cannot be verified or peer cert invalid
    Error: Cannot find a valid baseurl for repo: base


  • dinakar Sep 6, 2013 @ 9:56

    Thanks for this article… It helped me a lot

  • Torsten Mar 18, 2013 @ 14:23

    Hi Team,

    so i have followed your how to! I use a ContOs 6.3

    So after the steps i want install a package with yum for tessting but i get the following messeag:

    could not retrieve mirrorlist….
    14: PYCURL ERROR 6 – Couldn d resolve host
    ERROR: Cannot find a valid baseurl for repo: base!

    For information the Server has no connection to the Internet! I have create a iso of the hole Repo from the internet and has mount it!

    I hope you can help me!


  • Prashant Nirgun Feb 23, 2013 @ 14:26

    i copied rpm from dvd and create local repository it works fine but i had an error while i used yum grouplist or yum groupinstall Development tools
    Obviously i dont have the package Group list anybody know from where i can get the list or build the list i am using RHEL6 32 Bit. Development tools is containing lot many packages i cant installed it one by one.

  • M.PASHA Jul 4, 2012 @ 12:35

    Hi Team,

    I have setup local and network yum server. Recently i got new application requirement which my present yum server does not have it. How can i update new rpm’s in present yum server.


  • Mithun Mar 29, 2012 @ 14:30

    Does yum comes along with the redhat dvd or we need to install it separately?

  • rashid Feb 14, 2012 @ 16:52

    without working yum you need to install a createrepo rpm with rpm command
    rpm -ivh createrepo-0.9.8-4.el6.noarch

    after this either download the rpms from a mirror (Redhat , Centos,etc)
    using lftp and wget or copy the rpms from dvd or use iso image

    i copied from dvd into the directory /srv/www/centos/yum

    next type following command to create the meta data and yum repos
    createrepo /srv/www/centos/yum

    next either edit yum.conf or make a new file in /etc/yum.repos.d with the .repo

    cd /etc/yum.repos.d
    vi mylocal.repo

    type the following lines or edit according to your directory structure

    that’s it so simple

  • Dinu Nov 30, 2011 @ 5:45

    without working “yum” how we execute the command “yum install createrepo” in step 1 ?

  • Javad Oct 8, 2011 @ 12:01

    Was really helpful!! Thanks a ton guys!!!

  • Sahil Jul 25, 2011 @ 7:35

    Thanks that was good one!!!!

  • rupan3rd May 13, 2011 @ 9:23

    Just a note about the suggested command to install createrepo manually:
    > # rpm -i /mnt/iso/4/Server/createrepo-0.4.4-2.fc6.noarch.rpm
    unless you have a “full” OS installation (which is likely not the case, as you are missing createrepo), the installation of the individual package is surely going to drag you into the hell of resolution of the dependencies before it can be actually installed.

    Not that I have a solution for the above issue, but is worth underlying that it is better to make sure createrepo is installed since the beginning.

  • Suresh May 10, 2011 @ 11:41

    I am getting the following error. please help me.

    Loaded plugins: rhnplugin
    Config Error: File contains no section headers.
    file: file://///etc/yum.repos.d/iso.repo, line: 1

  • VIKAS Apr 28, 2011 @ 23:33

    yum grouplist does not work with this method

  • Hieu Tran Apr 5, 2011 @ 4:19

    Created dvd.repo in /etc/yum.repos.d.

    Content of file:
    [el5 dvd] => [el5-dvd]
    name=Enterprise Linux dvd 20100405

  • Swaminathan Mar 17, 2011 @ 11:51

    I have Oracle EL5.5 installed in virtualbox 4.0.4.
    ISO mounted automatically in virtual dvd drive in /media/Enterprise Linux dvd 20100405.
    Created dvd.repo in /etc/yum.repos.d.

    Content of file:
    [el5 dvd]
    name=Enterprise Linux dvd 20100405
    baseurl=file:///media/”Enterprise Linux dvd 20100405″/Server
    gpgkey=file:///media/Enterprise Linux dvd 20100405/RPM-GPG-KEY file:///media/Enterprise Linux dvd 20100405/RPM-GPG-KEY-oracle

    yum clean all results:
    [root@primedbs Enterprise Linux dvd 20100405]# yum clean all
    Loaded plugins: security
    Bad id for repo: el5 dvd, byte = 3

    If I remove the space in repository ID as [el5dvd]
    yum clean all results:
    [root@primedbs Enterprise Linux dvd 20100405]# yum clean all
    Loaded plugins: security
    Options Error: Error parsing ‘file:///media/Enterprise Linux dvd 20100405/RPM-GPG-KEY file:///media/Enterprise Linux dvd 20100405/RPM-GPG-KEY-oracle’: URL must be http, ftp, file or https not “”

    Please help.

    • deanet Mar 17, 2011 @ 22:58


      you have 2 option:
      1. make sure your gpg is right.
      2. disable gpg check with gpgcheck=0

  • sathya Feb 28, 2011 @ 16:26

    software to play the video in linux

  • deanet Feb 24, 2011 @ 7:19

    you couldn’t createrepo on read only media.. you should use symlink tricks 😀

    [root@rhel6 ~]# cd /mnt/cdrom/Packages/
    [root@rhel6 Packages]# mkdir /mnt/repo
    [root@rhel6 Packages]# find . -name "*.rpm" -exec ln -s `pwd`/{} /mnt/repo/{} ;
    [root@rhel6 Packages]# cd /mnt/repo/
    [root@rhel6 repo]# createrepo .
    2865/2865 - pcsc-lite-libs-1.5.2-3.1.el6.i686.rpm
    Saving Primary metadata
    Saving file lists metadata
    Saving other metadata
    [root@rhel6 repo]# cat /etc/yum.repos.d/rhel-beta.repo
    name=Red Hat Enterprise Linux Beta
    [root@rhel6 repo]# yum update
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    rhel-beta-6                                              | 1.3 kB     00:00 ...
    rhel-beta-6/primary                                      | 1.3 MB     00:00 ...
    rhel-beta-6                                                           2865/2865
    Setting up Update Process
    No Packages marked for Update
    [root@rhel6 repo]# yum list | grep mysql-server
    This system is not registered with RHN.
    RHN support will be disabled.
    mysql-server.i686                     5.1.42-4.el6                   rhel-beta-6
    [root@rhel6 repo]#
    [root@rhel6 repo]# yum install mysql-server.i686
    Loaded plugins: rhnplugin
    This system is not registered with RHN.
    RHN support will be disabled.
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package mysql-server.i686 0:5.1.42-4.el6 set to be updated
    --> Processing Dependency: mysql = 5.1.42-4.el6 for package: mysql-server-5.1.42-4.el6.i686
    --> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.42-4.el6.i686
    --> Running transaction check
    ---> Package mysql.i686 0:5.1.42-4.el6 set to be updated
    ---> Package perl-DBD-MySQL.i686 0:4.013-3.el6 set to be updated
    --> Finished Dependency Resolution
    Dependencies Resolved
     Package               Arch        Version             Repository          Size
     mysql-server          i686        5.1.42-4.el6        rhel-beta-6        8.6 M
    Installing for dependencies:
     mysql                 i686        5.1.42-4.el6        rhel-beta-6        3.8 M
     perl-DBD-MySQL        i686        4.013-3.el6         rhel-beta-6        134 k
    Transaction Summary
    Install       3 Package(s)
    Upgrade       0 Package(s)
    Total download size: 13 M
    Installed size: 30 M
    Is this ok [y/N]: y
    Downloading Packages:
    Total                                            19 MB/s |  13 MB     00:00
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing     : mysql-5.1.42-4.el6.i686                                  1/3
      Installing     : perl-DBD-MySQL-4.013-3.el6.i686                          2/3
      Installing     : mysql-server-5.1.42-4.el6.i686                           3/3
      mysql-server.i686 0:5.1.42-4.el6
    Dependency Installed:
      mysql.i686 0:5.1.42-4.el6          perl-DBD-MySQL.i686 0:4.013-3.el6
    [root@rhel6 repo]#

    gud lak.. 😉

  • Ouk Khean Feb 6, 2011 @ 9:48

    Still error, I can’t install from ISO image.
    Please help.

  • Rashid Iqbal Nov 26, 2010 @ 10:50

    hope that I was drunk.
    let me refine my question.
    I want to setup yum repository
    I copied the cd/DVD file into /var/www/html/centos
    vim /etc/yum.repos.d/server.repo
    name=server repository

    when I tried to install the software through
    yum –enablerepo=server install package name

    me receiving the same mentioned above error.

  • me Nov 25, 2010 @ 22:23

    Are you drunken?

    setting up a software-repro by using yum and a software-repro? Well man, I don’t know what you are smoking, but I like to ask you if you mind to share it …

  • Rashid Iqbal Aug 13, 2010 @ 10:53

    I am trying to create the local repository but getting errors: below ism y setup
    mount -o loop CentOS-5.5-i386-bin-DVD.iso /data/iso/dvd
    cd /data/dvd
    createrepo .

    vi /etc/yum.repository.d/iso.repo

    when I tried to install the software thorugh
    yum –enablerepo=iso.repo install bind

    [root@server ~]# yum –enablerepo=iso.repo install bind
    Loaded plugins: fastestmirror
    Repository ‘My-ISO-Repositary’ is missing name in configuration, using id

    Error getting repository data for iso.repo, repository not found
    [root@server ~]#

    Kinldly help me solve this problem

  • Greg May 28, 2010 @ 16:39

    What about errors like this one when I tried “yum install expect”

    Public key for expect-5.43.0-5.1.i386.rpm is not installed

    I know I can force but is there a way to clear it up?

    • Per May 31, 2010 @ 7:59


      It’s probably because the package is signed, and you don’t have the gpg key.
      To bypass this, type:
      yum install expect –nogpg

      • Ronan Jun 8, 2010 @ 16:06

        It didn’t work for me.
        I had to type:
        yum install package-name –nogpgcheck

        • Ronan Jun 8, 2010 @ 16:08

          with 2 dashes – –
          when you type 2 dashes they appear as one long one

  • Christophe Quintard May 19, 2010 @ 8:26

    what you need to do is to use another directory for the repository data :
    # mkdir /tmp/repo
    # cd /mnt/iso
    # createrepo -o /tmp/repo .

    Then use /tmp/repo as the repository directory instead of /mnt/iso

  • Shaikh Dawood Apr 25, 2010 @ 20:16

    For “Bad id repo” problem the solution is that the repository ID should not have a spaces
    IT should be [My-ISO-Repository]

    • Ajeet Jul 25, 2010 @ 10:42


      Awesome !!! That worked for me.Thanks.

    • Suresh Jul 25, 2011 @ 9:01

      Thank you very much!!! Now it is working perfectly.

  • Sadiel Apr 20, 2010 @ 12:52

    Nice answer, but when I did all that step I got this error:
    Bad id for repo: My ISO Repository, byte=2
    I were searching in internet only I found one answer and don’t resolve my problem.
    Could you help me, please? I can’t download from internet, so my only way to install something in federo is in you way.

  • sarath Apr 16, 2010 @ 4:52


    When iam trying the second step that is :

    # cd /mnt/iso
    # createrepo .
    am getting an error as follows:
    Directory /mnt/iso/. must be writable.

    Please help……

    Sarath M.

  • baseurlme Jan 28, 2010 @ 2:46

    Hi and thank you for the tips, they are great. I will be using the following entry, which should work I believe.

    Looks good to you? I will be doing this in about two weeks and will let you know how it goes. Any suggestions?
    Thanks again for the assist.

  • Bijan Jan 19, 2010 @ 7:47

    Hey elvir, thanks for the tipc. I had the exact problem 😉

  • elvir Dec 30, 2009 @ 16:02

    Thanks for Howto, for some reason when this implemented for RHEL 5.4 in case there is name of repository in iso.repo set up as
    [My ISO Repository]
    it will complain with error
    bad id for repo
    and will not index files …
    [MyISORepository] ….no spaces in repsitory name.


    • Stefan Lasiewski Sep 16, 2010 @ 18:58

      Thanks for this fix!

  • Uv Dec 12, 2009 @ 23:12

    I am wondering how you createrepo within an ISO image
    That needs a trick to mount writable as it does not on its own.
    Please share this trick….

  • Usamantaray Jun 19, 2009 @ 6:16

    Error : Repository ‘MY ISO Repository’ is missing name in configuration, using id
    Fix :
    # vi /etc/yum.repos.d/iso.repo
    [My ISO Repository]

  • Procfs Mar 18, 2009 @ 4:41

    Hi thanks this workes grate

  • ratzdecan Mar 17, 2009 @ 17:34

    You have to import all the gpg keys for the packages.
    rpm –import /mnt/iso/{1,2,3}/RPM-GPG-KEY

    Take a look here:

  • brandon Jan 27, 2009 @ 0:19

    so I’ve gone through this process, and have all 7 of rhel 5.3 iso’s (cd files) mounted and as the location for the repo, however it doesn’t want to complete without the public key. do I have to generate and import a key?

  • alice Sep 3, 2008 @ 14:11

    Use /etc/yum.repos.d/CentOS-Media.repo

  • fizzix Apr 1, 2008 @ 13:52

    Thanks for the tip. Seems to work great for the most part.

    I used it to create a local repo for FC7 with the original fc7 isos and an Everything snapshot as of ~Jan ’08. Most of the packages are fine, but some of them ( in particular) are prepending a “1:” to the version number so it’s failing the dependency check.

    –> Package 1:2.2.0-14.8 set to be updated
    –> Processing Dependency: = 1:2.2.0-14.8 for
    –> Finished Dependency Resolution
    Error: Missing Dependency: = 1:2.2.0-14.8 is needed by package

    But I’ve got installed!

    Looking through yum list available shows a subset of packages with the “1:” prepended to the version number.

    Any thoughts on how I can get around this?

    Thanks in advance.

  • 🐧 nixCraft Sep 12, 2007 @ 16:23


    Thanks for pointing out this issue

  • Henk Kloepping Sep 12, 2007 @ 10:48

    yum may not be able to install ‘createrepo’ as it may need a repository to find it – you know, the one you try to create ;-)..

    This can be resolved by installing it ‘by hand’, e.g.

    # rpm -i /mnt/iso/4/Server/createrepo-0.4.4-2.fc6.noarch.rpm

    Thanks for the article, keep it up!

  • prince Aug 10, 2007 @ 18:10

    thanks for the thismanual,can u tell me how to install update and coresponsding dependancies from a url like

    • noor Jan 22, 2011 @ 18:13

      it is not working for me.

      • noor Jan 22, 2011 @ 18:50

        hi all,

        yes right, when yum is configured locally it is working. how to do that on the client machine.

        client is nfs client. how will i configure yum repository now.
        becos it is giving error if i configured in the same way. problem is it is unable to read /mnt/iso/1 directory.

        error downloading packages kernel-headers-2.6.18-194: failure: 1/Server/kernel-headers…rpm from my_iso_repository: errno 256 no more mirrors to try.

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @