
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
enabled=1
Save and close the changes.
Now use yum command to install packages from ISO images:
# yum install package-name
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- 10 Greatest Open Source Software Of 2009
- My 10 UNIX Command Line Mistakes
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
- Email this to a friend
- Download PDF version
- Printable version
- Comment RSS feed
- Last Updated: Dec/18/2007


{ 13 comments… read them below or add one }
thanks for the thismanual,can u tell me how to install update and coresponsding dependancies from a url like rpm.pbone.net
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!
Henk,
Thanks for pointing out this issue
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 (openoffice.org-pyuno in particular) are prepending a “1:” to the version number so it’s failing the dependency check.
–> Package openoffice.org-pyuno.i386 1:2.2.0-14.8 set to be updated
–> Processing Dependency: openoffice.org-core = 1:2.2.0-14.8 for package:openoffice.org-pyuno
–> Finished Dependency Resolution
Error: Missing Dependency: openoffice.org-core = 1:2.2.0-14.8 is needed by package openoffice.org-pyuno
But I’ve got openoffice.org-2.2.0-14.8 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.
Use /etc/yum.repos.d/CentOS-Media.repo
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?
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:
http://www.linuxquestions.org/questions/fedora-35/public-key-not-installed-468615/
Hi thanks this workes grate
Error : Repository ‘MY ISO Repository’ is missing name in configuration, using id
Fix :
# vi /etc/yum.repos.d/iso.repo
[My ISO Repository]
name=ISO
baseurl=file:///mnt/iso
enabled=1
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….
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 …
workaround
[MyISORepository] ….no spaces in repsitory name.
Regards,
Hey elvir, thanks for the tipc. I had the exact problem ;)
Hi and thank you for the tips, they are great. I will be using the following entry, which should work I believe.
[MyUpdateRepository]
name=updater
baseurl=file:///repo_update/updaterepos
enabled=1
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.