Redhat6.9配置centos yum源
首先配置网络源需要一些安装包,先简单罗列出来:
python-iniparse-0.3.1-2.1.el6.noarch.rpm
python-urlgrabber-3.9.1-11.el6.noarch.rpm
yum-3.2.29-73.el6.CentOS.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm
可以到这个网站直接下载:http://mirrors.163.com/centos/6/os/x86_64/Packages/
不过里面的安装包确实太多了,找起来要花费点时间,如果下面介绍的在线获取的方式没有问题,可以节约不少时间,当然有兴趣可以进入找找看。
1创建文件夹
[root@master01 centos6Yum]# pwd
/centos6Yum
2下载文件
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
如果以上命令不能正确执行,提示网站没有响应,就是这个包已经找不到了,因为版本更新,老版本的包删掉了,只有新版本的包,所以按原来的文件名是不可能找到的,因此得自己到上面那个网站里去匹配这些安装包,名字是基本不会变的,变的是版本号。
现在基本工作已经做好了,接下来就进行安装和配置:
1、安装之前要先卸载系统本来的yum源,执行以下命令
[root@master01 centos6Yum]# rpm -aq|grep yum|xargs rpm -e --nodeps
2、查询一下是否完全卸载了
[root@master01 centos6Yum]# rpm -qa |grep yum
执行完这一条命令没有任何信息提示,就表示已经完全卸载了。(啰嗦一句,给刚接触Linux的提示一下,其他的可以飘过。在Linux下如果命令执行成功是不会出现任何提示,有错误才会提示)
3、先安装这下面的两个包
[root@master01 centos6Yum]# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
[root@master01 centos6Yum]# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
4、接下来尝试安装这两个包,一定要一起安装,也就是要在一条命令中执行,不可以跟上面的两个包一样分两条指令执行(网上的教程说是包的依赖关系)
[root@master01 centos6Yum]# rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
更改配置文件
[root@master01 yum.repos.d]# pwd
/etc/yum.repos.d
[root@master01 yum.repos.d]# vi CentOS-Base.repo
#The mirror system uses the connecting IP address of the client and the
#update status of each mirror to pick mirrors that are updated to and
#geographically close to the client. You should use this for CentOS updates
#unless you are manually picking other mirrors.
#If the mirrorlist= does not work for you, as a fall back you can try the
#remarked out baseurl= line instead.
[base]
name=CentOS-6 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/os/ b a s e a r c h / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / 6 / o s / basearch/ http://mirrors.aliyuncs.com/centos/6/os/ basearch/http://mirrors.aliyuncs.com/centos/6/os/basearch/
http://mirrors.cloud.aliyuncs.com/centos/6/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-6 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/updates/ b a s e a r c h / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / 6 / u p d a t e s / basearch/ http://mirrors.aliyuncs.com/centos/6/updates/ basearch/http://mirrors.aliyuncs.com/centos/6/updates/basearch/
http://mirrors.cloud.aliyuncs.com/centos/6/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/extras/ b a s e a r c h / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / 6 / e x t r a s / basearch/ http://mirrors.aliyuncs.com/centos/6/extras/ basearch/http://mirrors.aliyuncs.com/centos/6/extras/basearch/
http://mirrors.cloud.aliyuncs.com/centos/6/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/centosplus/ b a s e a r c h / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / 6 / c e n t o s p l u s / basearch/ http://mirrors.aliyuncs.com/centos/6/centosplus/ basearch/http://mirrors.aliyuncs.com/centos/6/centosplus/basearch/
http://mirrors.cloud.aliyuncs.com/centos/6/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/6/contrib/ b a s e a r c h / h t t p : / / m i r r o r s . a l i y u n c s . c o m / c e n t o s / 6 / c o n t r i b / basearch/ http://mirrors.aliyuncs.com/centos/6/contrib/ basearch/http://mirrors.aliyuncs.com/centos/6/contrib/basearch/
http://mirrors.cloud.aliyuncs.com/centos/6/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6|
7、清除原来的源配置
[root@master01 yum.repos.d]# yum clean all
8、安装现在的yum源,这一步也是测试新安装的yum源有没有安装成功
[root@master01 yum.repos.d]# yum install yum
如果这条命令能执行成功,就说明新安装的yum源已经正确配置好了。
9、更新yum源到本地
[root@master01 yum.repos.d]# yum list
我到这里就已经完全没有问题了,如果有其他问题,到网上找找解决办法。这个可能也会随着时间的推移而失效,所以能提供只是个大概的方向,具体细节只能具体分析。