yum使用本地光盘作为源
挂载CentOS光盘
1 2
| mkdir /mnt/cdrom mount -t iso9660 /dev/cdrom /mnt/cdrom
|
移除网络源
1 2 3
| cd /etc/yum.repos.d/ mv CentOS-Base.repo CentOS-Base.repo.bak mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.bak
|
增加本地源配置
1 2
| cp CentOS-Media.repo My.repo vi My.repo
|
以下是My.repo的内容
1 2 3 4 5 6
| [c6] name=CentOS-$releasever - Media baseurl=file:///mnt/cdrom/ gpgcheck=1 #0表示不作校验, 1表示要校验 enabled=1 #0表示不启用该REPO, 1表示启用 gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-6 #gpgcheck=1时需要该配置
|
验证
执行yum list
1 2 3 4 5 6 7 8 9 10 11
| [root@localhost cdrom]# yum list | more Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile Installed Packages ConsoleKit.i686 0.4.1-3.el6 @anaconda-CentOS-201311271240.i386/6.5 ConsoleKit-libs.i686 0.4.1-3.el6 @anaconda-CentOS-201311271240.i386/6.5 MAKEDEV.i686 3.24-6.el6 @anaconda-CentOS-201311271240.i386/6.5 SDL.i686 1.2.14-3.el6 @anaconda-CentOS-201311271240.i386/6.5 abrt.i686 2.0.8-21.el6.centos @anaconda-CentOS-201311271240.i386/6.5 abrt-addon-ccpp.i686 2.0.8-21.el6.centos @anaconda-CentOS-201311271240.i386/6.5 ......
|
出现以上信息即表示repo正常添加