第一步,在etc目录下建立ftp目录, 并将centos6.4第一张iso安装盘所有文件复制到centos目录下。
# mkdir /etc/centos
图型界面下进入centos6.4第一张iso安装盘所有文件复制到ftp目录下。
第二步,进入 /etc/yum.repos.d目录, 配置默认的yum源为本地指定目录,即为/etc/ftp。 其它的全部禁止。
# cd /etc/yum.repos.d
# ls -a
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo
----
#mv CentOS-Base.repo CentOS-Base.repose_bak
#mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo_bak
第三步,修改配置文件CentOS-Media.repo
#vim CentOS-Media.repo
Code:
[root@sl yum.repos.d]# more CentOS-Media.repo #repo后缀
# CentOS-Media.repo
#
# This repo can be used with mounted DVD media, verify the mount point for
# CentOS-6. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c6-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c6-media [command]
[c6-media] #库名称
name=CentOS-$releasever - Media #名称描述
baseurl=file:///ftp/centos/ #yum源目录,源地址
gpgcheck=1 #检查GPG-KEY,0为不检查,1为检查
enabled=1 #是否用该yum源,0为禁用,1为使用
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #gpgcheck=0时无需配置
第四步,测试yum是否配置成功
# yum list