yum不能使用解决办法
在安装完linux系统后,执行yum,发现报错,不能正常使用。解决方法如下:
1.查看系统中是否有安装yum
rpm -qa | grep yum
如果有返回,说明yum是安装了的,但还是不能正常使用,所以要卸载掉原来的yum
2.卸载yum
rpm -qa | grep yum | xargs rpm -e --nodeps
再次执行rpm -qa | grep yum 发现没有返回,说明yum已卸载干净
3.重新安装yum
# wgethttp://www.showerlee.com/down/python-iniparse-0.3.1-2.1.el6.noarch.rpm
# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
# wgethttp://www.showerlee.com/down/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
# wgethttp://www.showerlee.com/down/yum-3.2.29-30.el6.centos.noarch.rpm
# wgethttp://www.showerlee.com/down/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
# rpm -ivh yum-3.2.29-30.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
# wgethttp://www.showerlee.com/down/PackageKit-yum-0.5.8-20.el6.x86_64.rpm
# rpm -ivh PackageKit-yum-0.5.8-20.el6.x86_64.rpm
# wgethttp://www.showerlee.com/down/PackageKit-yum-plugin-0.5.8-20.el6.x86_64.rpm
# rpm -ivh PackageKit-yum-plugin-0.5.8-20.el6.x86_64.rpm
4.下载配置源
# cd /etc/yum.repos.d/
# wgethttp://docs.linuxtone.org/soft/lemp/CentOS-Base.repo
5.验证yum是否正常使用
执行yum命令,出现yum 选项
大功告成.......
rpm 修复:
cd /var/lib
# mv rpm rpm.old
# mkdir rpm
# rpmdb --initdb
# rpmdb --rebuilddb
完成修复