yum安装问题(rpm: 未找到命令)

解决yum安装问题

[root@base ~]# yum -y install yum-utils device-mapper-persistent-data lvm2
error: Unable to open /usr/lib/rpm/rpmrc for reading: No such file or directory.
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   cannot import name ts

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.7.5 (default, Nov 16 2020, 22:23:17) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://yum.baseurl.org/wiki/Faq
  
[root@base ~]# rpm -e –nodeps rpm
-bash: rpm: 未找到命令

解决

这是由于误操作导致rpm文件缺失导致
将另一台完好的服务器上RPM文件及缺失文件上传至异常服务器上即可修复

异常服务器A:192.168.182.139
完好服务器B: 任意

服务器B操作

[root@base ~]# scp /bin/rpm root@192.168.182.139:/bin/rpm
[root@base ~]# scp /usr/lib/rpm/rpmrc  root@192.168.182.139:/usr/lib/rpm/rpmrc
[root@base ~]# scp /usr/lib/rpm/macros  root@192.168.182.139:/usr/lib/rpm

如下

[root@base ~]# scp /bin/rpm root@192.168.182.139:/bin/rpm
The authenticity of host '192.168.182.139 (192.168.182.139)' can't be established.
ECDSA key fingerprint is f2:28:ad:25:c5:f0:98:ce:9d:7c:a9:6d:17:b7:6f:99.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '192.168.182.139' (ECDSA) to the list of known hosts.
root@192.168.182.139's password: 
rpm                                100%   16KB  15.8KB/s   00:00    
[root@base ~]# scp /usr/lib/rpm/rpmrc  root@192.168.182.139:/usr/lib/rpm/rpmrc
root@192.168.182.139's password: 
Permission denied, please try again.
root@192.168.182.139's password: 
rpmrc                              100%   15KB  15.0KB/s   00:00    
[root@base ~]# scp /usr/lib/rpm/macros  root@192.168.182.139:/usr/lib/rpm
root@192.168.182.139's password: 
macros                             100%   37KB  37.3KB/s   00:00 

测试192.168.182.139

[root@base ~]# rpm -e –nodeps rpm
-bash: rpm: 未找到命令
[root@base ~]# ^C
[root@base ~]# yum -y install yum-utils device-mapper-persistent-data lvm2
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: mirrors.bupt.edu.cn
 * extras: mirrors.bfsu.edu.cn
 * updates: mirrors.bfsu.edu.cn
base                                          | 3.6 kB     00:00     
extras                                        | 2.9 kB     00:00     
updates                                       | 2.9 kB     00:00     
updates/7/x86_64/primary_db                     |  13 MB   00:03     
软件包 yum-utils-1.1.31-54.el7_8.noarch 已安装并且是最新版本
软件包 device-mapper-persistent-data-0.8.5-3.el7_9.2.x86_64 已安装并且是最新版本
软件包 7:lvm2-2.02.187-6.el7_9.5.x86_64 已安装并且是最新版本
无须任何处理
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

jsxllht

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值