redhat 有些版本无法直接使用YUM源的解决办法

# yum repolist
    Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    repolist: 0

解决方法:
1、卸载原有YUM及相关软件包。
    # rpm -qa | grep yum | xargs rpm -e --nodeps
    # rpm -qa |grep python-urlgrabber|xargs rpm -e --nodeps
    # rpm -qa |grep python-iniparse|xargs rpm -e --nodeps

2、下载centos6的相关软件包。
    # wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-73.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-37.el6.noarch.rpm
    # 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
*注释:这些软件包的具体的版本,请到http://mirrors.163.com/centos/6/os/x86_64/Packages/ 目录下,选择下载上述软件包。网上很多文章没法直接使用就是因为软件包的版本问题。

3、安装软件包。
    # rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
    # rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm
    # rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
    # rpm -ivh yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm yum-3.2.29-73.el6.centos.noarch.rpm
*注释 yum-plugin-fastestmirror 和 yum-3.2.29 要一起安装,否则会报错。

4、替换新的repo文件。
    # cd /etc/yum.repos.d/
    # wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
    # sed -i "s;\$releasever;6;g" CentOS6-Base-163.repo
    # mv rhel-source.repo rhel-source.repo.bak

5、使用yum安装软件包测试。
    # yum install -y sl

 

你可能感兴趣的:(Linux基础)