Did You Know?
Got a tip? Let us know

We are pleased to announce our new TecMint Q/A section to submit your Linux questions

Install Software Packages via YUM command using CentOS 6/5 Installation DVD/CD

Download Your Free eBooks NOW - 10 Free Linux eBooks for Administrators
CW

The Yum tool uses online repositories from the internet to install, update and remove software packages under Linux systems. It is the default package manager tool for CentOS Linux and you must be connected to internet in order to install and update packages, without internet connection yum command is not going to work.

CentOS DVD Yum Install

Install Packages from CentOS DVD

This article guides you on how to configure CentOS system to use the DVD/CD installation media as source for installing software packages, but make sure your CentOS system is up-to-date.

Installing Software Packages from CentOS 6/5 DVD/CD Installation via YUM

First, insert your CentOS installation DVD/CD inside the cdrom drive and mount the drive under /media/cdrom directory, because every CentOS 6.x/5.x version has default CentOS-Media.repo file under /etc/yum.repos.d/ that contains the default mount location (/media/cdrom) of DVD/CD that is used by Yum command to install packages.

[root@tecmint]# mount /dev/cdrom /media/cdrom
mount: block device /dev/sr0 is write-protected, mounting read-only

If you see similar message, then it means that the device is mounted correctly as read only mode under /media/cdrom directory. Next, open CentOS-Media.repo configuration file with VI editor and change “enabled=0” to “enabled=1” and save the file.

[root@tecmint# vi /etc/yum.repos.d/CentOS-Media.repo
# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
#  CentOS-6.  You can use this repo and yum to install items directly off the
#  DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
#  yum --enablerepo=c6-media [command]
#
# or for ONLY the media repo, do this:
#
#  yum --disablerepo=\* --enablerepo=c6-media [command]

[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
        file:///media/cdrom/
        file:///media/cdrecorder/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

The file uses default mount location for Cdrom/DVD (i.e /media/cdrom/) as a repo for installing software package from the installation DVD. To install packages with YUM use the following command based on your CentOS version. For example, the following command will install lynx package using media as a repo.

For CentOS 6.x
[root@tecmint# yum --disablerepo=\* --enablerepo=c6-media install lynx
For CentOS 5.x
[root@tecmint# yum --disablerepo=\* --enablerepo=c5-media install lynx
Sample Output :
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
 * c6-media:
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package lynx.i686 0:2.8.6-27.el6 will be installed
--> Processing Dependency: redhat-indexhtml for package: lynx-2.8.6-27.el6.i686
--> Running transaction check
---> Package centos-indexhtml.noarch 0:6-1.el6.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved
==================================================================================================
 Package			Arch		Version		Repository	Size
==================================================================================================
Installing:
 lynx				i686		2.8.6-27.el6	c6-media	1.3 M
Installing for dependencies:
 centos-indexhtml               noarch		6-1.el6.centos	c6-media	70 k

Transaction Summary
==================================================================================================
Install       2 Package(s)

Total download size: 1.4 M
Installed size: 4.7 M
Is this ok [y/N]: y
Downloading Packages:
----------------------------------------------------------------------------------------------------------------
Total																			527 kB/s | 1.4 MB     00:02
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : centos-indexhtml-6-1.el6.centos.noarch													1/2
  Installing : lynx-2.8.6-27.el6.i686                                                                   2/2
  Verifying  : lynx-2.8.6-27.el6.i686                                                                   1/2
  Verifying  : centos-indexhtml-6-1.el6.centos.noarch                                                   2/2

Installed:
  lynx.i686 0:2.8.6-27.el6

Dependency Installed:
  centos-indexhtml.noarch 0:6-1.el6.centos

Complete!

Thats It! If you are looking for more yum command options for installing and removing packages, please read the following article that covers the practical examples of yum commands.

See Also : 20 Linux YUM command examples.

Ravi Saive

Owner at TecMint.com
Simple Word a Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux.

Linux Services & Free WordPress Setup

Our post is simply ‘DIY’ aka ‘Do It Yourself, still you may find difficulties and want us to help you out. We offer wide range of Linux and Web Hosting Solutions at fair minimum rates. Please submit your orders by Clicking Here.

3 Responses

  1. Kasun says:

    Thank You Very Much,
    Working FINE… :)

  2. Akash says:

    I am trying to block the CD drives in cent OS 6 (64x) and i did that

    1. cd /lib/modules/$(uname -r)/kernel/drivers/cdrom ;

    2 . mv cdrom.ko cdrom.ko.bak ;

    3. echo ‘blacklist sr_mod’ >> /etc/modprobe.d/blacklist.conf ;

    4. echo ‘modprobe -r sr_mod’ >> /etc/rc.local ;

    Now CD rom is blocked as it’s not comming, But i have to unblock it so I removed the entry which I did in “/etc/modprobe.d/blacklist.conf” and “/etc/rc.local” also rename the .ko file to its original one. and also rebooted the system.

    Now there is no file name cdrom , dvd ,sr0 ,hdc in /dev (All are missing ) now how can i mount a CD without them…So can i bring them back.

    Please help…

  3. Kürten says:

    Mann Thank You so MUCH!!, you are a Meister.

Leave a Reply

This work is licensed under a (cc) BY-NC | TecMint uses cookies. By using our services, you comply to use of our cookies. More info: Privacy Policy.
© 2012-2014 All Rights Reserved.