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.

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.
[[email protected]]# 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.
[[email protected]# 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
[[email protected]# yum --disablerepo=\* --enablerepo=c6-media install lynx
For CentOS 5.x
[[email protected]# 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.
how to mount packages cent0s 5
@Manikandan,
Just insert your CentOS CD/DVD and issue following command to mount the packages.
Mann Thank You so MUCH!!, you are a Meister.
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…
Thank You Very Much,
Working FINE… :)