linux RHEL6.8配置yum yum: command not found 配置阿里yum源以及yum源安装出现ERROR14的解决方法

    在Linux下准备配置yum源时发现调用yum指令command not found。查找资料总结了一下缺失yum指令下的linux配置阿里yum源相关的配置流程。若存在自带yum可以先卸载:

查看已安装的yum包

#rpm –qa|grep yum

卸载软件包

#rpm -e --nodeps yum

1.下载yum指令包:  

    去163源目录中(http://mirrors.163.com/centos/6/os/x86_64/Packages/)下载下列yum指令包:

  • python-iniparse-0.3.1-2.1.el6.noarch.rpm 
  • yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm
  • yum-3.2.27-14.el6.centos.noarch.rpm
  • yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm    
   在163源目录中找到现行的版本(3导致错误直接复制链接可能因链接guo'qi),使用wget指令进行下载。例如在 http://mirrors.163.com/centos/6/os/x86_64/Packages/中找到现行版本python-iniparse-0.3.1-2.1.el6.noarch.rpm。右击复制链接地址在使用wget。

  • wget  http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

2.安装yum指令包:

    使用rpm -ivh安装进度显示来安装以上rpm包:

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm 

rpm -ivh yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm 

    后两项须同时安装否则会互相依赖:

rpm -ivh yum-3.2.27-14.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm 

3.替换自身源:

    进入目录:cd /etc/yum.repos.d

    在该目录下下载阿里yum源:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

    此处以Redhat6.8为例,注意原来的yum源配置文件是rhel-source.repo。这里把CentOS-Base.repo替换掉rhel-source.repo。

mv rhel-source.repo rhel-source.repo.bak

mv CentOS-Base.repo rhel-source.repo

    使用vim编辑器vim rhel-source.repo,进入文件信息如下:

[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
#released updates  
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/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-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/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-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1

enabled=0

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

将其中的$releasever改为6,因为linux无法识别$releasever导致网址出错而产生error14

4. 清理并重建缓存

yum clean all

yum makecache


                                                             





    

你可能感兴趣的:(linux RHEL6.8配置yum yum: command not found 配置阿里yum源以及yum源安装出现ERROR14的解决方法)