正文
个人使用的是centos,php的curl请求中https用的是openssl,而centos中默认是nss。个人折腾着下载了openssl编译安装后, 发现yum不能使用了。需要修复yum,改了yum国内源,yum makecache时却报错了:
There was a problem importing one of the Python modules required to run yum. The error leading to this problem was:
libssl.so.1.1: cannot open shared object file: No such file or directory
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, Jul 23 2015, 15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]
If you cannot solve this problem yourself, please go to the yum faq at:
http://yum.baseurl.org/wiki/Faq
查了下,说yum使用的https报错了,推测yum底层使用的python,https请求使用的是nss,查询后发现的确是。因为安装openssl失败, 导致yum使用nss异常了,需要修复yum。
修复yum
我们到下载的curl解码包位置:
cd /usr/local/src/curl-7.72.0
重新编译:
./configure --without-ssl --with-nss && make &&make install
完成后,重新更新yum缓存:
yum makecache
发现报错:
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
/usr/lib64/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, Jul 23 2015, 15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]
If you cannot solve this problem yourself, please go to the yum faq at:
http://yum.baseurl.org/wiki/Faq
是因为yum动态库使用了新安装libcurl库导致的。使用ldd查看动态库依赖关系:
ldd /usr/lib64/python2.6/site-packages/pycurl.so
linux-vdso.so.1 => (0x00007fffcd7f1000)
libcurl.so.4 => /usr/local/lib/libcurl.so.4 (0x00007f96dc3a2000)
libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 (0x00007f96dbffc000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f96dbdde000)
libc.so.6 => /lib64/libc.so.6 (0x00007f96dba4a000)
librt.so.1 => /lib64/librt.so.1 (0x00007f96db842000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f96db63d000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007f96db43a000)
libm.so.6 => /lib64/libm.so.6 (0x00007f96db1b6000)
/lib64/ld-linux-x86-64.so.2 (0x00007f96dc819000)
可以发现libcurl.so.4 指向了新安装的libcurl。
查找系统旧有的libcurl:
> find / -name "libcurl*"
输出:
/usr/lib64/libcurl.so.4
/usr/local/lib/libcurl.so.4
直接将/usr/local/lib/libcurl.so.4 软连接到旧有libcurl中
> rm /usr/local/lib/libcurl.so.4
>
> ln -s /usr/lib64/libcurl.so.4.1.1 /usr/local/lib/libcurl.so.4
然后再更新yum缓存:
yum makecache
报错:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
把/etc/yum.repos.d/epel.repo,文件第3行baseurl注释去掉,把第四行mirrorlist注释掉。
然后再更新yum缓存:
yum clean all
yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
* webtatic: uk.repo.webtatic.com
base | 3.7 kB 00:00
base/group_gz | 242 kB 00:00
base/filelists_db | 6.4 MB 00:00
base/primary_db | 4.7 MB 00:01
base/other_db | 2.8 MB 00:00
epel | 4.7 kB 00:00
epel/group_gz | 74 kB 00:00
epel/filelists_db | 7.9 MB 00:01
epel/prestodelta | 325 B 00:00
epel/primary_db | 6.1 MB 00:00
epel/other_db | 3.0 MB 00:00
extras | 3.4 kB 00:00
extras/filelists_db | 24 kB 00:00
extras/prestodelta | 2.2 kB 00:00
extras/primary_db | 29 kB 00:00
extras/other_db | 14 kB 00:00
http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-5.6-community/el/6/x86_64/repodata/repomd.xml: (28, 'connect() timed out!')
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: mysql56-community. Please verify its path and try again
这是说mysql56-community包源加载失败,我们可以把写这个源的位置上去掉,然后再更新yum软件包缓存。