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.
[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.
Latest posts by Ravi Saive (see all)
- 10 Useful Free Linux eBooks for Newbies and Administrators - December 9, 2013
- TeamViewer 9 Released – Install on RHEL/CentOS/Fedora and Debian/Ubuntu - December 8, 2013
- CentOS 6.5 Released – Upgrade from CentOS 6.x to CentOS 6.5 - December 2, 2013
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.