YUM ( Yellowdog Updater, Modified ) is an command-line package-management utility for RPM based Linux systems, It has been released under the GNU General Public License.
Yum is useful for RPMS which have dependencies, Yum searches for all dependencies of any RPM in all available repositories.
Due there is all necessary RPMS are locate on CentOS/RedHat OS DVD, In this article I will try to explain local repository using RedHat ISO so off-line we can able install any tool, utility or RPMS without any issue…
For YUM configuration, we should to add file with .repo extension to /etc/yum.repo.d directory.
checking YUM repository;
[root@earth ~]# yum repolist Loaded plugins: product-id, refresh-packagekit, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. repolist: 0 [root@earth ~]#
it depends on you configuration, you can use DVD or ISO files for local repository
[root@earth ~]# mkdir /ISO
lets first copy RedHat OS ISO file to /ISO directory;
[root@earth ~]# mkdir /RHEL65_REPO
to mount ISO files, Linux has /dev/loop devices.
[root@earth ISO]# mount -o loop /ISO/rhel-server-6.5-x86_64-dvd.iso /RHEL65_REPO/
to make perminant ISO mount point, we should to add line end of the /etc/fstab
Please bear in mind, file name, mount point can be different for you.
# Perminant Mount for RedHat OS iso file to /RHEL65_REPO
/ISO/rhel-server-6.5-x86_64-dvd.iso /RHEL65_REPO iso9660 defaults,loop 0 0
[root@earth ISO]# mount -a
After file copied and mount point created, now we can start with adding repository file
in my case I will named repository file as local.repo
NOTE: Important point is here file extention, it should be with .repo suffix.
vi /etc/yum.repos.d/local.repo [local] name=Red Hat Enterprise Linux $releasever - $basearch - Source baseurl='file:///RHEL65_REPO' enabled=1 gpgcheck=0 #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Regarding file, important parameter is [local] and enable=1 chnaging enable to 0 we can stop repository to work. you can also use gpgcheck=1 if you want to use RPM-GPG-KEY
Anyway let test and confirm that repository is enabled;
[root@earth ~]# yum repolist Loaded plugins: product-id, refresh-packagekit, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. repo id repo name status local Red Hat Enterprise Linux 6Server - x86_64 - Source 3,690 repolist: 3,690 [root@earth ~]#
As you can see; we have installed repository which includeds about 3,690 files.
Right now, we can search or install any RPM which we want to install…