Linux
关于yum安装报错
今天在服务器安装git时候报错,网上找了一番最终解决
今天在一台Centos7的服务器上使用yum安装git时报以下错误:
File "/usr/bin/yum", line 29, in ? yummain.user_main(sys.argv[1:], exit_code=True) File "/usr/share/yum-cli/yummain.py", line 229, in user_main errcode = main(args) File "/usr/share/yum-cli/yummain.py", line 84, in main base.getOptionsConfig(args) File "/usr/share/yum-cli/cli.py", line 184, in getOptionsConfig enabled_plugins=self.optparser._splitArg(opts.enableplugins)) File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 191, in _getConfig self._conf = config.readMainConfig(startupconf) File "/usr/lib/python2.4/site-packages/yum/config.py", line 754, in readMainConfig yumvars['releasever'] = _getsysver(startupconf.installroot, startupconf.distroverpkg) File "/usr/lib/python2.4/site-packages/yum/config.py", line 824, in _getsysver idx = ts.dbMatch('provides', distroverpkg) TypeError: rpmdb open failed
博主也是一脸懵逼,在其他的服务器上没出现这个问题,所以也是网上找了一番,最终成功解决这个问题,成功安装上了git,解决命令行如下:
rm -f /var/lib/rpm/__db* rpm --rebuilddb yum update
然后机器会重启以下,然后再重新通过yum安装git,成功安装上了。如果小伙伴们也遇到这个难题,不妨试一试。
0条评论