由于redhat的yum在线更新是收费的,如果没有注册的话不能使用,如果要使用,需将redhat的yum卸载后,安装CentOS yum工具,再配置其他源,以下为详细过程:

  • 删除redhat原有的yum及RedHat订阅软件包
# rpm -qa | grep subscription-manager-* | xargs rpm -e
# rpm -e yum-3.4.3-132.el7.noarch --nodeps
  • 安装163 yum软件包
# rpm -ivh http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm \
http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
  • 创建163 repo文件

# vi /etc/yum.repos.d/CentOS-Base-163.repo

[base]
name=CentOS-7 -Base
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates
[updates]
name=CentOS-7 - Updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful
[extras]
name=CentOS-7 - Extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7 - Plus
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=
enabled=
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
  • 更新仓库缓存

# yum clean all
# yum makecache

  • 列出所有仓库

# yum repolist

如果你运行yum update命令时,遇到以下错误,是因为你安装的是最小化系统,有些包缺失了
Delta RPMs disabled because /usr/bin/applydeltarpm not installed. 你需要安装deltarpm软件包,使用下面命令查看这个包的名称
yum provides '*/applydeltarpm' 然后安装它
# yum install deltarpm
04-02 00:45