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 Create Additional LVM on CentOS 6.3

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

..
..

Comments

Leave a Reply

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