1、備份/etc/yum.repos.d/檔案
[root@www ~]# cp -r /etc/yum.repos.d/ /etc/yum.repos.d.bak
[root@www ~]# ls /etc/yum.repos.d* -d
/etc/yum.repos.d /etc/yum.repos.d.bak
2.删除系統網絡yum檔案
[root@www ~]# rm -rf /etc/yum.repos.d/CentOS-Base.repo
[root@www ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repolist: 0
3.建立本地yum源配置檔案
[root@www ~]# vim /etc/yum.repos.d/cdrom.repo
[cdrom]
name=cdrom
baseurl=file:///mnt/cdrom
gpgcheck=0
enable=1
4.虛拟機連接配接DVD,挂載光驅
[root@www ~]# mkdir /mnt/cdrom
[root@www ~]# mount /dev/sr0 /mnt/cdrom/
mount: block device /dev/sr0 is write-protected, mounting read-only
5.列出yum倉庫
<a href="http://s1.51cto.com/wyfs02/M01/77/0F/wKiom1ZhpQrxbDRhAAAoV7yz1JY268.jpg" target="_blank"></a>
<a href="http://s4.51cto.com/wyfs02/M02/77/0F/wKiom1ZhpzHyogMxAAJOkaBK6zk129.jpg" target="_blank"></a>
[root@www ~]# yum install samba
6.删除yum<b>程序</b>
[root@www ~]# rm -f /var/run/yum.pid
本文轉自 HMLinux 51CTO部落格,原文連結:http://blog.51cto.com/7424593/1719757