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

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.

[[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.

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. 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. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

5 Responses

  1. manikandan says:

    how to mount packages cent0s 5

    • Ravi Saive says:

      @Manikandan,
      Just insert your CentOS CD/DVD and issue following command to mount the packages.

      # cd /dev/cdrom /mnt
      
  2. Kürten says:

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

  3. 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…

  4. Kasun says:

    Thank You Very Much,
    Working FINE… :)

Leave a Reply to manikandan Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.