现在进入到/etc/yum.repos.d目录
该目录有两个文件。一个是CentOS-Base.repo另外一个是CentOS-Media.repo
第一个文件CentOS-Base.repo负责在网络环境中的安装源管理,如果你的yum源是在网络上需要使用ftp HTTP等服务才能正确安装软件,请使用它。而你的yum源是在本机上就使用CentOS-Media.repo,将CentOS-Media.repo改名为CentOS-Media.repo.bak
在这里,既然已经制作的光盘镜像文件,那么就采用CentOS-Media.repo文件,而把CentOS-Base.repo改个名字。只要不是以.repo作为后缀就可以。比方说改名为CentOS-Base.repo.bak或者将CentOS-Base.repo移动到其他目录。
现在打开CentOS-Base.repo文件,在里面编辑
修改成如下内容:
[c5-media]
name=CentOS-$releasever - Media
baseurl=file:///yum/iso
# file:///media/cdrom/
# file:///media/cdrecorder/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
注意一下。在这个文件前面的注释里面有这样的内容:
# or for ONLY the media repo, do this:
#
# # or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c5-media [command]
[command]
就是说如果你只想使用本机上的yum源需要运行yum --disablerepo=[red]/[/red]* --enablerepo=c5-media
注意,文档中的斜线方向错了。需要改正。
[root@fom yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@fom yum.repos.d]# yum list
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Installed Packages
Deployment_Guide-zh-CN.noarch 5.2-11.el5.centos installed
Deployment_Guide-zh-TW.noarch 5.2-11.el5.centos installed
GConf2.i386 2.14.0-9.el5 installed
ImageMagick.i386 6.2.8.0-4.el5_1.1 installed
MAKEDEV.i386 3.23-1.2 installed
MySQL-python.i386 1.2.1-1 installed
NetworkManager.i386 1:0.7.0-9.el5 installed
NetworkManager-glib.i386 1:0.7.0-9.el5 installed
NetworkManager-gnome.i386 1:0.7.0-9.el5 installed
…………………………
[root@fom yum.repos.d]# system-config-packages
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Loading mirror speeds from cached hostfile
Loading mirror speeds from cached hostfile

更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14
