• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CentOS / RHEL 7 : How to setup yum repository using locally mounted DVD

By admin

yum is the primary tool for getting, installing, deleting, querying, and managing Red Hat Enterprise Linux RPM software packages from official Red Hat software repositories, as well as other third-party repositories. The post below describes step by step procedure to use a locally mounted RHEL 7 DVD iso as yum repository.

1. Mount the RHEL 7 installation media ISO to some directory. For example /mnt :

# mount -o loop rhel7.iso /mnt
Also read : Linux / UNIX : How to mount an iso file

2. Copy the media.repo file from the mounted directory /mnt /etc/yum.repos.d/ and name it as rhel7.repo.

# cp /mnt/media.repo /etc/yum.repos.d/rhel7.repo

3. Give appropriate permissions to the repository file.

# chmod 644 /etc/yum.repos.d/rhel7.repo

4. Modify the repo file and change the parameter gpgcheck=0 to gpgcheck=1 and add below 3 lines to the same file.

enabled=1
baseurl=file:///mnt/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

5. Once you have done all the changes, the final repo file shiould look like below.( Note that – media-id may be different depending on the version of RHEL for which DVD is used)

[InstallMedia]
name=DVD for Red Hat Enterprise Linux 7.3 Server
mediaid=9859238196.834790
metadata_expire=-1
gpgcheck=1
cost=500
enabled=1
baseurl=file:///mnt/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

6. Make sure you clear the related caches by yum clean all and subscription-manager clean once.

# yum clean all
# subscription-manager clean

Verify

Verify if you can list out the packages from the repo you just created.

# yum  --noplugins list
# yum repolist -v
    [snip]
    ISO-Server                                               | 4.1 kB     00:00     
    (1/2): ISO-Server/group_gz                                 | 134 kB   00:00     
    (2/2): ISO-Server/primary_db                               | 3.4 MB   00:00     
    Setting up Package Sacks
    pkgsack time: 0.001
    Repo-id      : ISO-Server
    Repo-name    : RHEL 7 Server DVD
    Repo-revision: 1424360184
    Repo-updated : Thu Feb 19 10:36:27 2017
    Repo-pkgs    : 4,371
    Repo-size    : 3.2 G
    Repo-baseurl : file:///mnt/
    Repo-expire  : 21,600 second(s) (last: Fri Jul 10 12:55:47 2017)
    Repo-filename: ///etc/yum.repos.d/rhel7.repo

    repolist: 4,371
CentOS / RHEL 6 : How to setup yum repository using locally mounted DVD

Filed Under: CentOS/RHEL 7

Some more articles you might also be interested in …

  1. How to Configure Multiple Fencing-device Levels in Pacemaker Cluster
  2. CentOS / RHEL 7 : How to Install GUI
  3. CentOS / RHEL 7 : How to change the verbosity of debug logs during booting
  4. RHEL 7 – RHCSA Notes : Create hard and soft links.
  5. How to install and configure Samba in CentOS / RHEL
  6. What are SELinux Users and how to Map Linux Users to SELinux Users
  7. How to modify the iSCSI initiator ID in Linux
  8. “passwd: Module is unknown” – error while changing the password in CentOS/RHEL 6
  9. How to Set External Network For Containers in Linux Containers (LXC)
  10. How to grow/extend XFS filesytem in CentOS / RHEL using “xfs_growfs” command

You May Also Like

Primary Sidebar

Recent Posts

  • MySQL: how to figure out which session holds which table level or global read locks
  • Recommended Configuration of the MySQL Performance Schema
  • MySQL: Identify what user and thread are holding on to a meta data lock that is preventing other queries from running
  • MySQL: How to kill a Long Running Query using max_execution_time
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary