YUM install package from cdrom

 

 

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

3 Responses to “YUM install package from cdrom”

  1. Admire Says:

    I have followed the above instructions. when I try to update using yum update package_name Iam getting the following message:

    Repository ‘MY ISO Repository’ is missing name in configuration, using id
    Repository ‘MY ISO Repository’ is missing name in configuration, using id
    Loading “installonlyn” plugin
    Setting up Update Process
    Setting up repositories
    core

    Cannot find a valid baseurl for repo: core
    Error: Cannot find a valid baseurl for repo: core

    Please help

  2. DK72 Says:

    Add a name parameter should solve your problem.

    [My ISO Repository]
    name=My ISO Repository
    baseurl=file:///mnt/iso
    enabled=1

  3. vikrant Says:

    As per suggestion i have done all settings as well as procedure but still get an error.
    Please Help

    [root@localhost yum.repos.d]# yum update all
    Loaded plugins: rhnplugin, security
    This system is not registered with RHN.
    RHN support will be disabled.
    file://var/ftp/pub/Server/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory: ‘/ftp/pub/Server/repodata/repomd.xml’
    Trying other mirror.
    Error: Cannot retrieve repository metadata (repomd.xml) for repository: My_Repository. Please verify its path and try again
    [root@localhost yum.repos.d]# cat Server.repo
    [My_Repository]
    name=My_Repository
    baseurl=file://var/ftp/pub/Server
    enabled=1
    gpgcheck=0

Leave a Reply