Tag Archives: local repository

How to Configure Local Repository using a DVD iso in Red Hat Enterprise Linux/CentOS/Oracle Enterprise Linux?

To install softwares/packages in Red Hat Enterprise Linux, one needs to use either yum or rpm.

The full form of yum is Yellow Dog Updater Modifier, it uses rpm in background. If one installs packages using rpm, he/she needs to resolve the dependencies of the packages by himself/herself whereas in yum, the dependencies are automatically gets resolved, with the help of yum metadata, which can be created through local repository.

Repository of packages is a collection of rpm packages helping yum to resolve dependencies and install them properly using user friendly way.

To create a repository in Red Hat Enterprise Linux 6.4, using Local DVD iso, follow the steps given below. The steps can be used for Red Hat Enterprise Linux, CentOS or for Oracle Enterprise Linux as well.

Image

[1] Mount the DVD ISO to any directory.

    # ls
    /tmp/rhel-server-6.4-x86_64-dvd.iso

    # mkdir /localrepo
    # mount -o loop /tmp/rhel-server-6.4-x86_64-dvd.iso /localrepo

[2] Make an entry in /etc/fstab file to make that mount permanent across reboots.

# echo “/tmp/rhel-server-6.4-x86_64-dvd.iso  /localrepo  iso9660 defaults,loop 0 0” » /etc/fstab

[3] Take backup of all your old repositories.

    # mkdir /old_repo

    # mv /etc/yum.repos.d/* /old_repo/

[4] Create the following file in /etc/yum.repos.d/ which is your new repository now.

    # vi /etc/yum.repos.d/myrepo.repo
    [rhel-local]
    name=Red Hat Enterprise Linux 6.4 Local repository
    baseurl=file:///localrepo
    enabled=1
    gpgcheck=0

[5] Run the following commands to clean the old yum cache and create new cache.

    # yum clean all

    # rm -rf /var/cache/yum/*

    # yum makecache

    # yum repolist

[6] The following commands will show the group information of packages.

    # yum grouplist

    # yum install ‘<packagename>’

In this way, one can install the packages through local repository.

Leave a comment

Filed under Uncategorized