欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

RHEL 6.6配置网易CentOS镜像的yum源小结

程序员文章站 2022-04-15 15:27:19
之前没有使用过网易CentOS镜像的yum源,最近由于需要,遂在一台测试服务器验证、测试了一下如何配置使用网易的Cent0S的yum源。此文仅仅是笔记性质,参考了网上大量资料(文末“参考资料”的相关链接)。 1: 删除RHEL 6.6原有的YUM相关包 [root@gettestlnx03 ~]# ... ......

 

   之前没有使用过网易centos镜像的yum源,最近由于需要,遂在一台测试服务器验证、测试了一下如何配置使用网易的cent0s的yum源。此文仅仅是笔记性质,参考了网上大量资料(文末参考资料的相关链接)。

 

 

1: 删除rhel 6.6原有的yum相关包

 

[root@gettestlnx03 ~]# rpm -qa | grep yum
yum-plugin-security-1.1.30-30.el6.noarch
kabi-yum-plugins-1.0-2.el6.noarch
packagekit-yum-0.5.8-23.el6.x86_64
yum-plugin-downloadonly-1.1.30-30.el6.noarch
yum-rhn-plugin-0.9.1-50.el6.noarch
yum-plugin-changelog-1.1.30-30.el6.noarch
yum-plugin-versionlock-1.1.30-30.el6.noarch
yum-3.2.29-60.el6.noarch
yum-presto-0.6.2-1.el6.noarch
yum-plugin-aliases-1.1.30-30.el6.noarch
packagekit-yum-plugin-0.5.8-23.el6.x86_64
yum-utils-1.1.30-30.el6.noarch
yum-plugin-verify-1.1.30-30.el6.noarch
yum-plugin-tmprepo-1.1.30-30.el6.noarch
yum-metadata-parser-1.1.2-16.el6.x86_64
[root@gettestlnx03 ~]# rpm -qa | grep yum | xargs rpm -e --nodeps
warning: /etc/yum.conf saved as /etc/yum.conf.rpmsave
[root@gettestlnx03 ~]# rpm -qa | grep yum
[root@gettestlnx03 ~]# 

 

 

 

2:下载yum的相关安装包

 

 

注意:由于yum源一直在更新,所以有可能下面这些安装包已经不存在了(新的安装包给替换了),所以必须直接去网易的官方镜像验证确认,如果更新了,使用最新的安装包即可。http://mirrors.163.com/centos/6/os/x86_64/packages/

 

 

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-metadata-parser-1.1.2-16.el6.x86_64.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/packages/yum-plugin-fastestmirror-1.1.30-41.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/python-iniparse-0.3.1-2.1.el6.noarch.rpm

 

 

网上有些资料还安装了其它yum相关包。这里测试发现这些包已经足够,当然测试也不充分,理解没有深入。仅仅是使用简单的功能

 

3:安装yum相关包以及依赖的包

 

 

[root@gettestlnx03 tmp]# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm 
warning: python-iniparse-0.3.1-2.1.el6.noarch.rpm: header v3 rsa/sha256 signature, key id c105b9de: nokey
preparing...                ########################################### [100%]
        package python-iniparse-0.3.1-2.1.el6.noarch is already installed

 

安装python-urlgrabber与原来的python中的组件冲突,如下所示,之前卸载yum相关组件时,没有卸载python-urlgrabber-3.9.1-9.el6.noarch

 

[root@mytestlnx03 tmp]# rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm
warning: python-urlgrabber-3.9.1-11.el6.noarch.rpm: header v3 rsa/sha1 signature, key id c105b9de: nokey
preparing...                ########################################### [100%]
        file /usr/lib/python2.6/site-packages/urlgrabber/grabber.py from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
        file /usr/lib/python2.6/site-packages/urlgrabber/grabber.pyc from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
        file /usr/lib/python2.6/site-packages/urlgrabber/grabber.pyo from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
        file /usr/lib/python2.6/site-packages/urlgrabber/progress.pyc from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
        file /usr/lib/python2.6/site-packages/urlgrabber/progress.pyo from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
[root@mytestlnx03 tmp]# rpm -qa|grep python-url
python-urlgrabber-3.9.1-9.el6.noarch
[root@mytestlnx03 tmp]# rpm -e --nodeps python-urlgrabber-3.9.1-9.el6.noarch
[root@mytestlnx03 tmp]# rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm
warning: python-urlgrabber-3.9.1-11.el6.noarch.rpm: header v3 rsa/sha1 signature, key id c105b9de: nokey
preparing...                ########################################### [100%]
   1:python-urlgrabber      ########################################### [100%]
 
 
[root@mytestlnx03 tmp]# rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm   yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
warning: yum-3.2.29-81.el6.centos.noarch.rpm: header v3 rsa/sha1 signature, key id c105b9de: nokey
preparing...                ########################################### [100%]
   1:yum-metadata-parser    ########################################### [ 33%]
   2:yum-plugin-fastestmirro########################################### [ 67%]
   3:yum                    ########################################### [100%]

4:修改yumrepo配置文件

 

删除原yum的配置文件

 

[root@gettestlnx03 tmp]# cd /etc/yum.repos.d/
[root@gettestlnx03 yum.repos.d]# ls 
backup  redhat.repo  rhel-source.repo  server.repo
[root@gettestlnx03 yum.repos.d]# rm -rf *

 

下载repo文件,放在 /etc/yum.repos.d/下面

 

[root@gettestlnx03 yum.repos.d]# wget http://mirrors.163.com/.help/centos6-base-163.repo
--2019-07-22 14:11:02--  http://mirrors.163.com/.help/centos6-base-163.repo
connecting to 192.168.27.92:3128... connected.
proxy request sent, awaiting response... 200 ok
length: 2006 (2.0k) [application/octet-stream]
saving to: “centos6-base-163.repo”
 
100%[=================================================================================================>] 2,006       --.-k/s   in 0s      
 
2019-07-22 14:11:02 (73.2 mb/s) - “centos6-base-163.repo” saved [2006/2006]
 
[root@gettestlnx03 yum.repos.d]# 

 

修改配置文件centos6-base-163.repo:将baseurl中的$releasever修改为centos版本号,这里使用6替换,如下截图所示:

 

 

5:测试验证yum配置是否正确

 

[root@gettestlnx03 ~]# yum clean all

[root@gettestlnx03 ~]# yum list | grep ls

 

 

 

 

参考资料:

 

https://blog.csdn.net/dujianxiong/article/details/78481912

https://www.cnblogs.com/ssyfj/p/9172147.html

http://mirrors.163.com/centos/6/