RedHat配置阿里yum源

  • 系统版本如下uanme -a:
Linux localhost 2.6.32-431.20.3.el6.x86_64 #1 SMP Thu Jun 26 11:55:21 ICT 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# yum update
Loaded plugins: axtu-plugin, security
Please register, or you can not connect to Asianux Update Server!
Setting up Update Process
No Packages marked for Update

1.卸载自带yum源

[root@localhost ~]# rpm -aq | grep yum | xargs rpm -e --nodeps
[root@localhost ~]# whereis yum
yum: /etc/yum
[root@localhost ~]# rm -rf /etc/yum

2.下载阿里yum安装包

  • 此处用的CentOS6:下载地址
  • 执行命令,下载以下安装包(更新于2019/07/22):
wget https://mirrors.aliyun.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm --no-check-certificate
wget https://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm --no-check-certificate
wget https://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm --no-check-certificate
wget https://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm --no-check-certificate

3. 安装yum相关rpm包

  • 安装python*
[root@localhost ~]# rpm -ivh python*
warning: python-iniparse-0.3.1-2.1.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:python-iniparse        ########################################### [100%]
  • 安装yum*,如果出现以下报错
[root@localhost ~]#  rpm -ivh yum*
warning: yum-3.2.29-81.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
    python-urlgrabber >= 3.9.1-10 is needed by yum-3.2.29-81.el6.centos.noarch

查看系统的python信息低于3.9.1-19

[root@localhost ~]# rpm -qa|grep python-url
python-urlgrabber-3.9.1-9.AXS4.noarch

先卸载python-urlgrabber-3.9.1-9.AXS4.noarch

[root@localhost ~]# rpm -e python-urlgrabber-3.9.1-9.el6.noarch
error: package python-urlgrabber-3.9.1-9.el6.noarch is not installed

重新下载

wget https://mirrors.aliyun.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm --no-check-certificate

安装python-urlgrabber-3.9.1-11.el6.noarch.rpm,如果出现以下提示信息:

[root@localhost ~]#rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm # 使用此方法安装可能会有如下提示信息
    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.AXS4.noarch

则需要使用强制安装:

[root@localhost ~]# rpm -ivh --force 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%]
  • 完成之后重新执行rpm -ivh yum*
[root@localhost ~]# rpm -ivh yum*
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%]

配置阿里云yum源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
  • 如果yum list出现404,则将CentOS-Base.repo中的$releasever全部替换为系统的版本值
[root@localhost yum.repos.d]# sed -i 's/$releasever/6/g' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost]# yum clean all
[root@localhost]# yum list

参考链接

更换红旗Linux: Asianux的yum源为网易源
linux——rhel安装yum

猜你喜欢

转载自www.cnblogs.com/zy37275/p/11300682.html
今日推荐