由于RedHat是商业版的,通常由于没有注册,导致yum程序无法使用(linux下面,yum是个安装软件的“神器”)。此时可用CentOS的地址进行替换。下面将一步步说明如何处理:

一、检查Redhat Linux自带的yum源

       命令:rpm -qa | grep yum

      

二、卸载Redhat自带的yum源

      命令:rpm -e ****yum源名称**** --nodeps

      举例:rpm -e yum-plugin-fastestmirror-1.1.31-40.el7.noarch  --nodeps

      

      依次卸载所有Redhat Linux中自带的所有yum源。

三、检查Redhat Linux中自带的yum源是否全部卸载

      命令:rpm -qa | grep yum

四、通过网易网站来源下载rpm文件,以下命令逐条执行。

      命令:1. wget http://vault.centos.org/centos/7.3.1611/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm

                 2. wget http://vault.centos.org//centos/7.3.1611/os/x86_64/Packages/yum-updateonboot-1.1.31-40.el7.noarch.rpm

                 3. wget http://vault.centos.org/centos/7.3.1611/os/x86_64/Packages/yum-utils-1.1.31-40.el7.noarch.rpm

                 4. wget http://vault.centos.org/centos/7.3.1611/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

                 5. wget http://vault.centos.org/centos/7.3.1611/os/x86_64/Packages/yum-3.4.3-150.el7.centos.noarch.rpm

五、执行命令下载完毕之后,安装rpm。

[root@localhost root]# rpm -ivh yum-*
warning: yum-3.4.3-150.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:yum-metadata-parser-1.1.4-10.el7 ################################# [ 20%]
   2:yum-plugin-fastestmirror-1.1.31-4################################# [ 40%]
   3:yum-3.4.3-150.el7.centos         ################################# [ 60%]
   4:yum-updateonboot-1.1.31-40.el7   ################################# [ 80%]
   5:yum-utils-1.1.31-40.el7          ################################# [100%]

六、配置repo文件。

        命令:vim /etc/yum.repos.d/CentOS-Base.repo

        注意:如果文件名不是CentOS-Base.repo,将文件名修改为CentOS-Base.repo即可。以下代码为修改好之后,注意各自系统版本修改。如版本一致,直接覆盖即可。

[base]
name=CentOS-$releasever -Base
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7

[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7

七、检查/etc/yum.repos.d目录下只有一个CentOS-Base.repo起作用。如有多个,可将文件备份移除。

        命令:yum clean all

yum clean all
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: base extras updates
Cleaning up everything

八、检测可用,配置网易163yum源成功。

Logo

更多推荐