Using Centos DVD as Yum Repository

Centos coming with dvd/cd as installation media, in some case you want to use it as yum repository. In this tech tips posting, I used centos 5.6 dvd.

1. Mount your dvd media under one of this directory as default :

/media/CentOS/
/media/cdrom/
/media/cdrecorder/

I mount it under /media/CentOS directory, if not exist you should create it

# mount /dev/cdrom-hdc /media/CentOS

2. edit the configuration :

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

make sure enabled = 1

[c5-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-5

Testing the repo:

3. If you want to use your dvd repo along another repo :

# yum --enablerepo=c5-media install package-name

example:

# yum --enablerepo=c5-media install nmap

4. If you want to use only your dvd repo :

# yum --disablerepo=\* --enablerepo=c5-media install package-name

Example :

# yum --disablerepo=\* --enablerepo=c5-media install nmap
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * c5-media: 
c5-media                                                                                                | 1.3 kB     00:00     
c5-media/primary                                                                                        | 1.2 MB     00:00     
c5-media                                                                                                             3539/3539
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package nmap.x86_64 2:4.11-1.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==================================
 Package                    Arch                         Version                          Repository                      Size
==================================
Installing:
 nmap                       x86_64                       2:4.11-1.1                       c5-media                       680 k

Transaction Summary
==================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 680 k
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
c5-media/gpgkey                                                                                         | 1.5 kB     00:00     
Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) <centos-5-key@centos.org>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : nmap                                                                                                    1/1 

Installed:
  nmap.x86_64 2:4.11-1.1                                                                                                       

Complete!
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s