无法使用yum安装程序的解决方法

实验室的项目做的快差不多了,昨天打算新装一台Centos机器进行下测试,师兄们先装的redis、ssh、mysql、PHP等等需要的开发包和模块,我守在最后一关,但是到我这里时候,yum不能使用了。报错内容如下:

There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

/usr/lib/python2.6/site-packages/pycurl.so: undefined symbol: CRYPTO_set_locking_callback

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.6.6 (r266:84292, Dec 7 2011, 20:38:36)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)]

If you cannot solve this problem yourself, please go to
the yum faq at:

http://yum.baseurl.org/wiki/Faq

测试机器是Centos6 64位系统,刚开始我以为是python冲突(yum是python写的),重装了python没有解决。之后又删掉了yum,折腾了大半夜,没有解决,之后我仔细阅读了上文中的错误报告,于是使用命令:

ldd /usr/lib/python2.6/site-packages/pycurl.so

程序显示内容如下:

[root@centOS6 site-packages]# ldd /usr/lib/python2.6/site-packages/pycurl.so
linux-gate.so.1 => (0x006da000)
libcurl.so.4 => /usr/lib/libcurl.so.4 (0x0065f000)
libpython2.6.so.1.0 => /usr/lib/libpython2.6.so.1.0 (0x00394000)
libpthread.so.0 => /lib/libpthread.so.0 (0x006f8000)
libc.so.6 => /lib/libc.so.6 (0x0087c000)
libidn.so.11 => /lib/libidn.so.11 (0x00a47000)
libldap-2.4.so.2 => /lib/libldap-2.4.so.2 (0x00110000)
librt.so.1 => /lib/librt.so.1 (0x00bf6000)
libgssapi_krb5.so.2 => /lib/libgssapi_krb5.so.2 (0x0056f000)
libkrb5.so.3 => /lib/libkrb5.so.3 (0x0015d000)
libk5crypto.so.3 => /lib/libk5crypto.so.3 (0x00fc1000)
libcom_err.so.2 => /lib/libcom_err.so.2 (0x00a83000)
libz.so.1 => /lib/libz.so.1 (0x0024f000)
libssl3.so => /usr/lib/libssl3.so (0x00263000)
libsmime3.so => /usr/lib/libsmime3.so (0x00790000)
libnss3.so => /usr/lib/libnss3.so (0x00a88000)
libnssutil3.so => /usr/lib/libnssutil3.so (0x00299000)
libplds4.so => /lib/libplds4.so (0x00233000)
libplc4.so => /lib/libplc4.so (0x00238000)
libnspr4.so => /lib/libnspr4.so (0x00f7e000)
libdl.so.2 => /lib/libdl.so.2 (0x00e34000)
libssh2.so.1 => /usr/local/lib/libssh2.so.1 (0x00bff000)
libutil.so.1 => /lib/libutil.so.1 (0x002b5000)
libm.so.6 => /lib/libm.so.6 (0x0032c000)
/lib/ld-linux.so.2 (0x00374000)
liblber-2.4.so.2 => /lib/liblber-2.4.so.2 (0x00d8a000)
libresolv.so.2 => /lib/libresolv.so.2 (0x002b9000)
libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x002d3000)
libkrb5support.so.0 => /lib/libkrb5support.so.0 (0x002ee000)
libkeyutils.so.1 => /lib/libkeyutils.so.1 (0x00d3b000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x002f9000)
libselinux.so.1 => /lib/libselinux.so.1 (0x00a24000)
libfreebl3.so => /lib/libfreebl3.so (0x005ae000)

我发现libssh2.so.1 => /usr/local/lib/libssh2.so.1 (0x00bff000) ,指向了/usr/local/lib。记忆中许多linux系统是默认安装ssh的。于是命令查看

[root@centOS6 lib]# find / -name “libssh2.so.1″
/usr/local/lib/libssh2.so.1
/usr/lib/libssh2.so.1

感觉应该是动态库冲突引起的yum不能使用。

于是编辑 vim /etc/ld.so.conf

include ld.so.conf.d/*.conf
/usr/local/lib

改为:

include ld.so.conf.d/*.conf
#/usr/local/lib

之后,再用ldconfig刷新下动态链接库,问题解决。

PS:可能自己程序安装的动态链接库位置在/usr/local/lib,删掉/usr/local/lib可能会影响用户自己安装程序使用。不更改ld.so.conf,建立个软链接应该可以解决。

你可能感兴趣的:(linux)