Total Pageviews

Wednesday 26 April 2017

RHEL-7 - Setup Local YUM repository

Setup Local Yum Repo
====================
1. Transfer/download ISO on local server on desired path (in my case /root)

2. mount ISO to /mnt, as mentioned below
[root@dcamvirldcT001 yum.repos.d]# mount -o loop /root/rhel-server-7.2-x86_64-dvd.iso /mnt/

3. Locate .repo file on /etc/yum.repo.d  and take copy of orignal .repo file
[root@ominvirldcT001 yum.repos.d]# ll
total 4
-rw-r--r-- 1 root root 359 Apr 26 19:30 redhat.repo
[root@ominvirldcT001 yum.repos.d]# cp -p redhat.repo redhat.repo.orig
[root@ominvirldcT001 yum.repos.d]# ll
total 8
-rw-r--r-- 1 root root 359 Apr 26 19:30 redhat.repo
-rw-r--r-- 1 root root 359 Apr 26 19:30 redhat.repo.orig
[root@ominvirldcT001 yum.repos.d]#

4. Edit redhat.repo as per you ISO path as mentioned below.
[root@ominvirldcT001 yum.repos.d]# cat redhat.repo
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# *** This file is auto-generated.  Changes made here will be over-written. ***
# *** Use "subscription-manager repo-override --help" if you wish to make changes. ***
#
# If this file is empty and this system is subscribed consider
# a "yum repolist" to refresh available repos
#
[LocalRepo]
name=Local Repository
baseurl=file:///mnt
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@ominvirldcT001 yum.repos.d]#

5. .repo file permision should be 644, else change chmod 644 redhat.repo
[root@ominvirldcT001 yum.repos.d]# chmod 644 redhat.repo

6. clear the related caches by yum clean all and subscription-manager clean once
# yum clean all
# subscription-manager clean
#yum update all

[root@dcamvirldcT001 ~]# yum update all
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
LocalRepo                                                                                                                                        | 4.1 kB  00:00:00
(1/2): LocalRepo/group_gz                                                                                                                        | 136 kB  00:00:00
(2/2): LocalRepo/primary_db                                                                                                                      | 3.6 MB  00:00:00
No Match for argument: all
No package all available.
No packages marked for update
[root@ominvirldcT001 ~]#

7. check whether you can get the packages list from the DVD repo
# yum  --noplugins list

8. if no problem , you wil update
# yum  --noplugins update

No comments:

Post a Comment