redhat7.5 yum不能用

 Redhat 7自带的yum源需要付费注册,未注册情况下会报如下错误。这时候需要将RedHat 7自带的yum源 替换成CentOS 7免费源,解决步骤如下:

1,查看原有yum包

rpm -qa|gerp yum

2,卸载yum包

rpm -qa|grep yum|xargs rpm -e --nodeps
rpm -qa|grep yum

3,创建下载路径,下载centos7.7 yum包

wget http://mirrors.163.com/centos/7.7.1908/os/x86_64/Packages/yum-3.4.3-163.el7.centos.noarch.rpm

wget http://mirrors.163.com/centos/7.7.1908/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

wget http://mirrors.163.com/centos/7.7.1908/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm

4,安装下载好的rpm包

rpm -ivh yum-*
rpm -qa|grep yum

5,替换原有源

cd /etc/yum.repos.d/ && rm -rf *

6,下载163源

wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

7,将下载好的文件中的 $releasever 全部修改为目标版本 7.7.1908

为防止出错,以下为改好版本

[base]
name=CentOS-7.7.1908 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=7.7.1908&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7.7.1908/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-7.7.1908 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=7.7.1908&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7.7.1908/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-7.7.1908 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=7.7.1908&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7.7.1908/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

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

8,更新

yum clean all && yum makecache

9,查看是否更新成功

yum repolist all

 

posted @ 2020-03-26 17:14  <Snooker>  阅读(486)  评论(0编辑  收藏  举报