1、挂载光盘到 /media下
[root@localhost ~]# mount /dev/cdrom /media
2、直接配置文件了。
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
redhat.repo rhel-source.repo
[root@localhost yum.repos.d]touch rhel-media.repo
[root@localhost yum.repos.d]# vi rhel-media.repo
[media]
name=Red Hat Enterprise Linux 6.2
baseurl=file:///media
enabled=1
gpgcheck=1
gpgkey=file:///media/RPM-GPG-KEY-redhat-release
3、清除原有缓存
[root@localhost ~]# yum clean all
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: media
Cleaning up Everything
4、获取yum列表
验证yum配置是否成功
[root@localhost ~]# yum makecache
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
media | 4.1 kB 00:00 ...
media/group_gz | 211 kB 00:00 ...
media/filelists_db | 3.3 MB 00:00 ...
media/primary_db | 3.1 MB 00:00 ...
media/other_db | 1.4 MB 00:00 ...
Metadata Cache Created
[root@localhost ~]#