近期在给linux漏洞扫描和配置核查,在升级openssh过程中,执行rpm -e gcc --nodeps和rpm - e zlib -- nodeps后,rpm和yum命令都无法正常使用。报error while loading shared libraries: libz.so.1: cannot open shared object file: 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:
No module named yum
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:
If you cannot solve this problem yourself, please go to the yum faq at:
http://wiki.linux.duke.edu/YumFaq
错误,谁叫自己手贱,上一次也是因为误删东西导致服务器重装。由于rpm命令无法使用,导致无法正常安装软件。网上说修改vi /usr/bin/yum启动Python与之系统版本一致,或者重装安装zlib或者gcc。各种方法试尽,就差重装系统了。后来请来高手,通过scp命令,把正常服务器下的libz.so库文件复制过来就可以正常使用rpm命令,在官网上下载zlib后,可以正常使用yum命令了。切记。
由于linux操作系统依赖太多,在获取root用户权限后,系统重要文件修改前记得备份。卸载软件或者依赖包时,慎重!