1) View Centos media repo file.
Since I use Centos 6.3 it is similar to following.you can use either less or cat command to view the file content. Some lines are removed due to brevityless /etc/yum.repos.d/CentOS-Media.repo
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
give more attention to following parameters
repo name -> c6-media
baseurl -> there is 3 file paths, those are the mount point of Centos DVD. you can customize it.
2) Create mount point if not exist
since this is demo, I create DVD mount location as first base URL. possible use any location which is defined in baseurl.[root@localhost ~]# mkdir /media/CentOS
3) mount centos cdrom
mount /dev/cdrom /media/CentOS/4)Install your package using yum
yum --disablerepo=\* --enablerepo=[repo name] install [pakage name]ex:-
yum --disablerepo=\* --enablerepo=c6-media install cpan
if this is not working, you may need to clean repo using following command
[root@localhost ~]# yum clean all