How To Add DVD ISO To Yum Repository In Centos 6

by
Share this Article: Facebook0Google+0Twitter6LinkedIn0Reddit0StumbleUpon0

I have some issues to connect to internet in my CentOS 6.4 minimal server and i need to install some packages right now. So what should i do now without internet?

Its very simple! I just added my CentOS 6.4 DVD location to my repository files found in the /etc/yum.repos.d/ directory and installed the software’s which i need.

This is how i added the CentOS DVD iso to my yum repository.

First of all, you need to create a mount point and mount the Installation Media.

# mkdir /mnt/cdrom

Mount the cdrom drive to /mnt/cdrom:

# mount /dev/cdrom /mnt/cdrom/
mount: block device /dev/sr0 is write-protected, mounting read-only

Check if it is correctly mounted:

# ls -altr /mnt/cdrom/

Sample output:

total 547
-r--r--r--. 2 root root 1734 Mar 1 16:15 RPM-GPG-KEY-CentOS-Testing-6
-r--r--r--. 2 root root 1730 Mar 1 16:15 RPM-GPG-KEY-CentOS-Security-6
-r--r--r--. 2 root root 1730 Mar 1 16:15 RPM-GPG-KEY-CentOS-Debug-6
-r--r--r--. 2 root root 1706 Mar 1 16:15 RPM-GPG-KEY-CentOS-6
-r--r--r--. 2 root root 18009 Mar 1 16:15 GPL
-r--r--r--. 2 root root 212 Mar 1 16:15 EULA
-r--r--r--. 2 root root 1354 Mar 1 16:15 RELEASE-NOTES-en-US.html
-r--r--r--. 2 root root 14 Mar 4 20:00 CentOS_BuildTag
dr-xr-xr-x. 2 root root 2048 Mar 4 20:12 isolinux
dr-xr-xr-x. 3 root root 2048 Mar 4 20:13 images
dr-xr-xr-x. 2 root root 509952 Mar 5 19:36 Packages
-r--r--r--. 1 root root 29 Mar 5 19:36 .discinfo
-r--r--r--. 1 root root 334 Mar 5 19:37 .treeinfo
-r--r--r--. 1 root root 3165 Mar 5 19:37 TRANS.TBL
dr-xr-xr-x. 2 root root 4096 Mar 5 19:37 repodata
dr-xr-xr-x. 6 root root 4096 Mar 5 19:37 .
drwxr-xr-x. 3 root root 4096 Aug 19 06:44 ..

Let us add ISO location to /etc/yum.repos.d/CentOS-Media.repo.

# nano /etc/yum.repos.d/CentOS-Media.repo

Make the changes as shown below. See the red coloured lines.

# CentOS-Media.repo
#
# This repo can be used with mounted DVD media, verify the mount point for
# 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/

## Add the following lines ##
file:///mnt/cdrom/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Now try to install some packages like ‘Gnome Desktop’.

# yum groupinstall "Desktop"

Cool it works now! Hope this method works for you too.

For questions please refer to our Q/A forum at : http://ask.unixmen.com/


Share this Article: Facebook0Google+0Twitter6LinkedIn0Reddit0StumbleUpon0