In this tutorial we will learn how to create DVD/CDROM as local yum repository in RHEL7 (Red Hat Enterprise Linux 7) . I have also written tutorial to create dvd as local yum repository in rhel5.You can click here to visit that article




Make directory /mnt/cdrom where we will mount cdrom/dvd

[root@shahid /]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.1 (Maipo)
[root@shahid /]# mkdir -p /mnt/cdrom

To find device name which you want to mount you can use below commands

[root@shahid /]# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0   20G  0 disk
ââsda1          8:1    0  500M  0 part /boot
ââsda2          8:2    0 19.5G  0 part
  âârhel-swap 253:0    0    2G  0 lvm  [SWAP]
  âârhel-root 253:1    0 17.5G  0 lvm  /
sr0            11:0    1  3.6G  0 rom

OR

[root@shahid cdrom]# ll /dev | grep sr0
lrwxrwxrwx. 1 root root           3 Feb  3 18:04 cdrom -> sr0
brw-rw----+ 1 root cdrom    11,   0 Feb  3 18:04 sr0

OR

dmesg | grep sr

You will find device name and then to mount use below command

[root@shahid /]# mount -t iso9660 /dev/sr0 /mnt/cdrom
mount: /dev/sr0 is write-protected, mounting read-only
[root@shahid /]# cd /mnt/cdrom

Go to /etc/yum.repos.d directory and create a file with extension repo ( i am creating dvd.repo for this tutorial)

[root@shahid cdrom]# cd /etc/yum.repos.d/
[root@shahid yum.repos.d]# ll
total 0
[root@shahid yum.repos.d]#
[root@shahid yum.repos.d]# vi dvd.repo

[DVD]
name=RHEL7-DEV REPO
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0

:wq

To check list of repositories configured use below command

[root@shahid yum.repos.d]# yum repolist
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
repo id                                                                                          repo name                                                                                               status
DVD                                                                                              RHEL7-DEV REPO                                                                                          4,371
repolist: 4,371
[root@shahid yum.repos.d]#





We can now see RHEL7-DEV REPO

Let’s see if we can search  example package (telnet) in yum repo

[root@shahid yum.repos.d]# yum search telnet
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
============================================================================================= N/S matched: telnet =============================================================================================
telnet.x86_64 : The client program for the Telnet remote login protocol
telnet-server.x86_64 : The server program for the Telnet remote login protocol
tn5250.i686 : 5250 Telnet protocol and Terminal
tn5250.x86_64 : 5250 Telnet protocol and Terminal

  Name and summary matches only, use "search all" for everything.
[root@shahid yum.repos.d]#

Now we will install telnet package by using yum install command

[root@shahid yum.repos.d]# yum install telnet
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
DVD                                                                                                                                                                                     | 4.1 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package telnet.x86_64 1:0.17-59.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================================
 Package                                          Arch                                             Version                                                 Repository                                     Size
===============================================================================================================================================================================================================
Installing:
 telnet                                           x86_64                                           1:0.17-59.el7                                           DVD                                            63 k

Transaction Summary
===============================================================================================================================================================================================================
Install  1 Package

Total download size: 63 k
Installed size: 113 k

Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:telnet-0.17-59.el7.x86_64                                                                                                                                                                 1/1
DVD/productid                                                                                                                                                                           | 1.6 kB  00:00:00
  Verifying  : 1:telnet-0.17-59.el7.x86_64                                                                                                                                                                 1/1

Installed:
  telnet.x86_64 1:0.17-59.el7

Complete!
[root@shahid yum.repos.d]#

Congratulations  you have successfully created dvd/cdrom as local yum repository and have installed first package from yum repo

I hope you have enjoyed this tutorial.If you have any suggestions please let us know .Your suggestions will be highly appreciated

Thanks

SUBSCRIBE OUR NEWSLETTER
I agree to have my personal information transfered to MailChimp ( more information )
Join us by subscribing to our newsletter and learn IT subjects for free
We hate spam. Your email address will not be sold or shared with anyone else.