How to Prepare Local Yum Repository from CD-ROM/DVD-ROM image on RHEL 7

If you have installed Red Hat Enterprise Linux 7 (RHEL 7) but do not have access to the redhat official repo, you will encounter problems installing and updating software. To solve the above problems, I have prepared a short step to update and install the RPM package from the CD-ROM/DVD-ROM image for RHEL 7. This step can also be used in RHEL 6 or older versions such as RHEL 5. For linux servers that do not have access to the internet or no access to the RHEL official repository, the steps below will help.

See also  How to Enable Logging for Email Subject Fields in Postfix Maillog

1. Mount the ISO from the DVD-ROM into /mnt directory :

[root@rhel7 ~]# mount /dev/cdrom /mnt

2. Take note the media ID :

[root@rhel7 ~]# cat /mnt/media.repo
[InstallMedia]
name=RHEL-7.0 Server.x86_64
mediaid=1294067623.154321
metadata_expire=-1
gpgcheck=0
cost=500

3. Create rhel7.repo text file in /etc/yum.repos.d/ with the following content. Make sure you include the correct media ID as above. Save the file :

[root@rhel7 ~]# vi /etc/yum.repos.d/rhel7.repo
[Local-DVD-RHEL7-Repository]
mediaid=1294067623.154321
name=DVD-RHEL7 repository
baseurl=file:///mnt
enabled=1
gpgcheck=0

4. Install, remove and update using yum command.

[root@rhel7 ~]# yum install perl -y

Example :

[root@rhel7 ~]# yum install perl -y
..
..
====================================================================================================
 Package                    Arch       Version                 Repository                      Size
====================================================================================================
Installing:
 perl                       x86_64     4:5.16.3-283.el7        Local-DVD-RHEL7-Repository     8.0 M
Installing for dependencies:
 perl-Carp                  noarch     1.26-244.el7            Local-DVD-RHEL7-Repository      19 k
 perl-Encode                x86_64     2.51-7.el7              Local-DVD-RHEL7-Repository     1.5 M
 perl-Exporter              noarch     5.68-3.el7              Local-DVD-RHEL7-Repository      28 k
 perl-File-Path             noarch     2.09-2.el7              Local-DVD-RHEL7-Repository      27 k
 perl-File-Temp             noarch     0.23.01-3.el7           Local-DVD-RHEL7-Repository      56 k
 perl-Filter                x86_64     1.49-3.el7              Local-DVD-RHEL7-Repository      76 k
 perl-Getopt-Long           noarch     2.40-2.el7              Local-DVD-RHEL7-Repository      56 k
 perl-HTTP-Tiny             noarch     0.033-3.el7             Local-DVD-RHEL7-Repository      38 k
 perl-PathTools             x86_64     3.40-5.el7              Local-DVD-RHEL7-Repository      83 k
 perl-Pod-Escapes           noarch     1:1.04-283.el7          Local-DVD-RHEL7-Repository      50 k
 perl-Pod-Perldoc           noarch     3.20-4.el7              Local-DVD-RHEL7-Repository      87 k
 perl-Pod-Simple            noarch     1:3.28-4.el7            Local-DVD-RHEL7-Repository     216 k
 perl-Pod-Usage             noarch     1.63-3.el7              Local-DVD-RHEL7-Repository      27 k
 perl-Scalar-List-Utils     x86_64     1.27-248.el7            Local-DVD-RHEL7-Repository      36 k
 perl-Socket                x86_64     2.010-3.el7             Local-DVD-RHEL7-Repository      49 k
 perl-Storable              x86_64     2.45-3.el7              Local-DVD-RHEL7-Repository      77 k
 perl-Text-ParseWords       noarch     3.29-4.el7              Local-DVD-RHEL7-Repository      14 k
 perl-Time-Local            noarch     1.2300-2.el7            Local-DVD-RHEL7-Repository      24 k
 perl-constant              noarch     1.27-2.el7              Local-DVD-RHEL7-Repository      19 k
 perl-libs                  x86_64     4:5.16.3-283.el7        Local-DVD-RHEL7-Repository     686 k
 perl-macros                x86_64     4:5.16.3-283.el7        Local-DVD-RHEL7-Repository      42 k
 perl-parent                noarch     1:0.225-244.el7         Local-DVD-RHEL7-Repository      12 k
 perl-podlators             noarch     2.5.1-3.el7             Local-DVD-RHEL7-Repository     112 k
 perl-threads               x86_64     1.87-4.el7              Local-DVD-RHEL7-Repository      49 k
 perl-threads-shared        x86_64     1.43-6.el7              Local-DVD-RHEL7-Repository      39 k

..
..

How to Reset the Directory Manager Password on RHEL 7 / CentOS 7
How to Reset the Directory Manager Password on RHEL 7 / CentOS 7

It is best practice to remember passwords, but because too many passwords, sometimes we forget. We are not encouraged to write the password on any paper or share the password...

How to Find Big Files Size on Linux RHEL/CentOS
How to Find Big Files Size on Linux RHEL/CentOS

As the linux administrator, sometimes we have to identify which files are most take much space in the linux server resulting in low free space. Low disk space can also...

Why Linux users should worry about malware and what they can do about it
Why Linux users should worry about malware and what they can do about it

Don’t drop your guard just because you’re running Linux. Preventing the spread of malware and/or dealing with the consequences of infection are a fact of life when using computers. If...

How to Reset Forgotten Root Password on Linux RHEL 7/CentOS 7
How to Reset Forgotten Root Password on Linux RHEL 7/CentOS 7

This article will explain the steps to reset a lost root password or to reset forgotten root password on Linux RHEL 7 or CentOS 7. Basically, the steps will adding...

How to Update CentOS or Upgrade CentOS to the Latest Version
How to Update CentOS or Upgrade CentOS to the Latest Version

Recently, the latest version of CentOS 7.3 was released. All users of CentOS 7.0, 7.1 and 7.2 can upgrade their system to the most recent. This quick guide will explain...

How to Change your WordPress Username, Nickname and Display Name in MySQL
How to Change your WordPress Username, Nickname and Display Name in MySQL

After you create an account log in WordPress, you may want to change your WordPress username, as appropriate or due to security reason. However, you can not do this from...

How to Enable SSH Root Login on Ubuntu 16.04
How to Enable SSH Root Login on Ubuntu 16.04

As what we wrote in the previous article on how to allow SSH root on Ubuntu 14.04, after installing a fresh new copy of Ubuntu 16.04 LTS, we find that...

How to Change UUID of Linux Partition on CentOS 7
How to Change UUID of Linux Partition on CentOS 7

UUID (Universally Unique IDentifier) should be unique and it is used to identify storage devices on a linux system. If you cloned a virtual machine from vCenter, the metadata containing...

Leave a Reply

Your email address will not be published. Required fields are marked *