You do not have access to the network and you would like to install some packages from CDROM/DVD, please follow the instructions:
First take a backup of /etc/yum.repos.d/ then remove these repo files:
CentOS-Base.repo, CentOS-Debuginfo.repo and CentOS-Media.repo
and add a new file called CentOS_local.repo with the following lines:
[root@localhost yum.repos.d]# cat CentosOS_local.repo
[dvd]
name=Centos DVD
baseurl=file:///media #mount location
enabled=1
gpgcheck=0
[root@localhost yum.repos.d]#
Here baseurl=file:///media is the location of CentOS iso. Now you have to mount your CentOS iso into the media folder:
[root@localhost]# mount /dev/cdrom /media
Once this is done, you can go ahead with yum to install packages from CD/DVD.