RedHat7.9更新网络yum源

本文详细描述了如何在RedHat系统中更换yum源,卸载并重新安装必要的包,修复DNS问题,配置yum仓库,以及清理和刷新yum缓存的过程。

以下操作均在root下进行: 

[redhat@root ~]$ cat /etc/redhat-release   查看对应的版本号
Red Hat Enterprise Linux Server release 7.9 (Maipo)

[redhat@root ~]$ rpm -qa |grep yum    查看安装的yum源
yum-utils-1.1.31-54.el7_8.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch
yum-3.4.3-168.el7.centos.noarch

[redhat@root ~]$ rpm -qa|grep yum|xargs rpm -e --nodeps  #强行卸载所以yum源

[redhat@root ~]$ rpm -qa|grep yum                        #再次查看为空
下载以下依赖
[redhat@root ~]$ 
wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/rpm-4.11.3-45.el7.x86_64.rpm

wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm

wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm

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

wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm

[redhat@root ~]$ rpm -ivh --force rpm-4.11.3-45.el7.x86_64.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm python-urlgrabber-3.10-10.el7.noarch.rpm yum-3.4.3-168.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm  --force  

如果出现以下问题

 解决方法

vim /etc/resolv.conf

加入以下内容

nameserver 8.8.8.8 
nameserver 8.8.4.4
nameserver 223.5.5.5
nameserver 223.6.6.6

 

[redhat@root ~]$ wget http://mirrors.aliyun.com/repo/Centos-7.repo

[redhat@root ~]$ mv Centos-7.repo /etc/yum.repos.d/

[redhat@root ~]$ vi /etc/yum.repos.d/Centos-7.repo

 %s/$releasever/7/g 

#使用vi编辑器进行全局替换

[redhat@root ~]$ cd /etc/yum.repos.d/

mv redhat.repo redhat.repo.bak

关闭订阅插件提示
[redhat@root ~]$ vi /etc/yum.conf
    plugins=0
[redhat@root ~]$ vim /etc/yum/pluginconf.d/subscription-manager.conf
    [main]
    enabled=0 #将它禁用掉

[redhat@root ~]$ yum clean all #清空 yum 缓存,使其设置生效

[redhat@root ~]$ yum makecache #加载服务器软件包缓存信息,提高搜索安装软件的速度

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值