redhat7更换yum为Centos yum (This system is not registered with an entitlement server. )

yum在有些linux版本是收费的,但是CentOS是免费的

更换yum (每一步都可以直接复制粘贴完成)(需要让虚拟机先链接到网络,没有连网可以参考后面 给出的图片)
1.wget + url 下载yum需要的软件包 (ctrl+c复制链接,linux终端下ctrl+shift+v粘贴)
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-aliases-1.1.31-45.el7.noarch.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-protectbase-1.1.31-45.el7.noarch.rpm
wget http://vault.centos.org/7.5.1804/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.3145.el7.noarch.rpm

第六个链接无效了,我传到了网盘上面
链接:https://pan.baidu.com/s/17dQ7LIamweKXu8eok4UEQQ
提取码:1okg
可以打开这个界面复制进去,就不用连ssh什么的了
redhat7更换yum为Centos yum (This system is not registered with an entitlement server. )_第1张图片

2.删除原有的yum
rpm -aq|grep yum|xargs rpm -e --nodeps

3.批量安装下载的安装包
rpm -Uvh --replacepkgs yum*.rpm

4.下载ali源
cd /etc/yum.repos.d/
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

5.修改repo文件
vim CentOS-Base.repo 打开下载的repo文件,你可以发现文件中有两个变量,分别是 r e l e a s e v e r 和 releasever和 releaseverbasearch。

6.通过sed命令进行替换:

sed -i ‘s/$releasever/7/g’ CentOS-Base.repo

sed -i ‘s/$basearch/x86_64/g’ CentOS-Base.repo

7.清除系统所有的yum缓存
yum clean all

8/生成yum缓存
yum makecache

更换完成

**配置网络(桥接模式下) **
redhat7更换yum为Centos yum (This system is not registered with an entitlement server. )_第2张图片
redhat7更换yum为Centos yum (This system is not registered with an entitlement server. )_第3张图片
redhat7更换yum为Centos yum (This system is not registered with an entitlement server. )_第4张图片
redhat7更换yum为Centos yum (This system is not registered with an entitlement server. )_第5张图片
在图形界面也进行连接

你可能感兴趣的:(linux)