CentOs更换yum,重新安装yum卸载yum
2021/5/23 7:29:37
本文主要是介绍CentOs更换yum,重新安装yum卸载yum,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1、卸载
rpm –e –nodeps yum
2、安装
下载安装依赖
打开浏览器,登录 http://mirrors.163.com/centos/7/os/x86_64/Packages/ ,找四个文件,如下(*****代表版本号,因为版本在不停更新,所以不能精确表明,直接下载最新即可)
1、yum-*****.rpm
2、yum-metadata-parser-*****.rpm
3、yum-plugin-fastestmirror-*****.rpm
4、python-iniparse-*****.rpm
这里我全部以假设下载的版本为1.0.0.0为例。
因文件有相互依赖性,故先安装 python-iniparse-.rpm 文件,再安装 yum-metadata-parser-.rpm,
安装命令如下:
rpm -ivh python-iniparse-1.0.0.0.rpm
rpm -ivh yum-1.0.0.0.rpm
后面的两个依赖需要强制安装,不管依赖性文件加上 “–nodeps –force” 命令
rpm -ivh –nodeps –force yum-plugin-fastestmirror-1.0.0.0.rpm
rpm -ivh –nodeps –force yum-1.0.0.0.rpm
安装过程如果出现警告不用理,如果出现error或者其他异常,请检查下载的版本兼容性。
3、更改 yum 源
如果觉得这个官方的太麻烦,直接使用我后面的连接下载文件覆盖原配置文件即可,见3.2
3.1、前往163.com下载配置文件(如果这个操作太麻烦,直接使用3.2方案)
http://mirrors.163.com/.help/CentOS7-Base-163.repo(注意系统的版本,不兼容)
将此配置文件替换/etc/yum.repos.d 同名文件,如果没有同名文件直接上传即可。
3.2、或者直接复制我的配置文件,文件命名为CentOs-Base.repo,然后上传至etc/yum.repos.d,如果这个目录下已经有CentOs-Base.repo以外的其他文件,全部删除掉。
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-7 - Base - 163.com failovermethod=priority baseurl=http://mirrors.163.com/centos/7/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-7 - Updates - 163.com failovermethod=priority baseurl=http://mirrors.163.com/centos/7/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 - Extras - 163.com failovermethod=priority baseurl=http://mirrors.163.com/centos/7/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 - Plus - 163.com failovermethod=priority baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
4、清理缓存
yum clean all
yum makecache
5、测试
yum install vim
这篇关于CentOs更换yum,重新安装yum卸载yum的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-07-05feign默认connecttimeout和readtimeout是多少-icode9专业技术文章分享
- 2024-07-05idea控制台,日志太多,导致部分想看得日志被刷走 搜不到-icode9专业技术文章分享
- 2024-07-05The server selected protocol version Tls10 is not accepted by client preferences [TLs12]-icode9专业技术文章分享
- 2024-07-05怎么清理项目缓存-icode9专业技术文章分享
- 2024-07-04安装 Eyoucms详细图文教程-icode9专业技术文章分享
- 2024-07-04ueditor 复制文章时,图片的链接是一个下载图片地址,该如何处理?-icode9专业技术文章分享
- 2024-07-04怎样判断host有没有对wordpress有缓存呢-icode9专业技术文章分享
- 2024-07-04具有编译功能的系统make后,无法ssh连接-icode9专业技术文章分享
- 2024-07-04make后如何升级ssh-icode9专业技术文章分享
- 2024-07-03微信支付提示下单账户与支付账户不一致-icode9专业技术文章分享