RHEL7删除yum命令后如何恢复
楼主也是不小心删除了rhel7上的yum命令,后来通过安装centos7的yum命令解决
1.首先下载yum相关的rpm包
http://mirrors.163.com/centos/7/os/x86_64/Packages/
python-iniparse-0.4-9.el7.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm
yum-3.4.3-154.el7.centos.noarch.rpm
2.下载完成之后用rpm命令进行安装
这里安装的时候需要注意,一定要加 --force --nodeps不然会报错安装不上
rpm -ivh --force --nodeps python-iniparse-0.4-9.el7.noarch.rpm
rpm -ivh --force --nodeps yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -ivh --force --nodeps yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm
rpm -ivh --force --nodeps yum-3.4.3-154.el7.centos.noarch.rpm
基本安装到这里yum就可以用了,但如果你下载的是旧版本的yum,有可能报错

一般RHEL因为没有注册是没有办法使用yum的,解决这个问题的办法是把/etc/yum.repos.d/下的文件全部删除,然后更换成CentOS的源即可
rm -rf /etc/yum.repos.d/*
vim centos.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-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
yum clean all&yum makecache
然后就可以用yum安装软件了
如果还不行,那就把系统的yum工具删了,然后用公网安装CentOS的yum工具,rpm+URL(上面有具体步骤)
RHEL7删除yum命令后如何恢复的更多相关文章
- centos7.0下删除yum和python之后恢复的办法
centos 7如果卸载了yum和python之后恢复的办法(该方法已经测试). 下载 地址 http://mirrors.163.com/centos/7/os/x86_64/Packages/ 下 ...
- 解决yum命令后出现libldap-2.4.so.2: cannot open shared object file
问题: [root@lgh ~]# yum There was a problem importing one of the Python modules required to run yum. T ...
- CentOS 使用yum命令安装Java SDK(openjdk)
CentOS 6.X 和 5.X 自带有OpenJDK runtime environment (openjdk).它是一个在linux上实现开源的java 平台.CentOS yum 命令 安装 ...
- CentOS7 使用yum命令安装Java SDK(openjdk)
CentOS 6.X 和 7.X 自带有OpenJDK runtime environment (openjdk).它是一个在linux上实现开源的java 平台. 安装方式: 1.输入以下命令,以 ...
- CentOS7使用yum命令安装Java1.8
CentOS7使用yum命令安装Java1.8 首先更新已安装的包:#yum update查看系统当前的java版本:#java -version==================== CentOS ...
- dataguard主库删除归档日志后从库恢复的方法
------------------方法1在主库上使用备份的进行恢复丢失的归档日志-------------------------1.发现主库备份后删除了归档,但是这些归档从库还没应用,也没有传到从 ...
- 将SD卡的音频设置为手机铃声后删除,手机铃声没有恢复到默认的问题
1. Android7.0,将存储卡中MP3设置为铃声,删除该MP3后,settings中的铃声没有变化,来电铃声也没有变化. 原因:android7.0的新特性 google 默认如此设计,在选择铃 ...
- CentOS6 系统下升级python后yum命令使用时报错
CentOS6 系统下升级python后yum命令使用时报错,如下: [root@xxxxxxx]#yumFile"/usr/bin/yum",line30exceptKeyboa ...
- windows 10 删除库后自动恢复的解决方法
目录 什么是windows 库? 手动删除不行吗? 如何正确的"删除"? title: windows 10 删除库后自动恢复的解决方法 date: 2019-06-09 15:4 ...
随机推荐
- [存一下]iptables模块
介绍地址: http://www.tummy.com/blogs/2005/07/17/some-iptables-modules-you-probably-dont-know-about/ [1] ...
- Java nio和io
当学习了Java NIO和IO的API后,一个问题马上涌入脑海: 我应该何时使用IO,何时使用NIO呢?在本文中,我会尽量清晰地解析Java NIO和IO的差异.它们的使用场景,以及它们如何影响您的代 ...
- [技巧篇]05.关于eclipse模版
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templa ...
- MongoDB入门(6)- 我们自己封装的MongoDB-C#版本
Wisdombud.Mongo 包含内容 MongoDB.Bson.dll MongoDB.Bson.xml MongoDB.Driver.dll MongoDB.Driver.xml Wisdomb ...
- redis cluster以及master-slave在windows下环境搭建
一.redis cluster环境搭建: 1.了解Redis Cluster原理: 详细了解可参考:http://doc.redisfans.com/topic/cluster-tutorial.ht ...
- jQuery中val()、text()、html()之间的差别
一.括号里没有值时表示取值 val获取表单中的值: text获取对象中的文本内容,不包含html标签: html获取对象中的内容,包括html标签 <!DOCTYPE HTML> & ...
- 【BZOJ2287】消失之物 [分治][DP]
消失之物 Time Limit: 10 Sec Memory Limit: 128 MB[Submit][Status][Discuss] Description ftiasch 有 N 个物品, ...
- hdu5828 Rikka with Sequence
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=5828 [题解] 考虑bzoj3211 花神游历各国,只是多了区间加操作. 考虑上题写法,区间全为1打标记 ...
- 联系博主 Contact
李莫 / Ray OI 蒟蒻一只 / A Player of Olympiad in Informatics QQ:740929894 邮箱 / Email :rayking2017@outlook. ...
- C#编写程序监测某个文件夹内是否有文件进行了增,删,改的动作?
新建一个Console应用程序,项目名称为“FileSystemWatcher”,Copy代码进,编译后就可以用了.代码如下: using System; using System.Collectio ...