centos 5.x 升级openssl

时间:2024-11-28 11:03:49

今日想在centos 5.2上面安装mysql 5.5.37,在make的时候提示:

Linking C shared module adt_null.so
[ 65%] Built target audit_null
Scanning dependencies of target vio
[ 65%] Building C object vio/CMakeFiles/vio.dir/vio.c.o
[ 65%] Building C object vio/CMakeFiles/vio.dir/viosocket.c.o
[ 65%] Building C object vio/CMakeFiles/vio.dir/viossl.c.o
/root/mysql-5.5.36/vio/viossl.c: In function ‘ssl_do’:
/root/mysql-5.5.36/vio/viossl.c:175: error: ‘SSL_OP_NO_COMPRESSION’ undeclared (first use in this function)
/root/mysql-5.5.36/vio/viossl.c:175: error: (Each undeclared identifier is reported only once
/root/mysql-5.5.36/vio/viossl.c:175: error: for each function it appears in.)
make[2]: *** [vio/CMakeFiles/vio.dir/viossl.c.o] Error 1
make[1]: *** [vio/CMakeFiles/vio.dir/all] Error 2
make: *** [all] Error 2

百度得知是mysql5.5无法在openssl-1.0.0及更低版本下编译导致的。如果不需要ssl可以去掉WITH_SSL配置项,也可以升级openssl的版本,当然还有个更方便的办法:

以在cmake之前打一个补丁。

#下载补丁 并安装 因centos所在机器不能上网,故未测试
wget -c "http://bugs.mysql.com/file.php?id=19941&bug_id=68999" -O mysql-openssl.patch patch -p1 mysql-openssl.patch

我采用升级openssl的方式

1.下载openssl 1.01 略.

2. 解压并安装openssl

tar vxf openssl-1.0.1g.tar.gz
cd openssl-1.0.1g
./config shared zlip

make && make install

mv /usr/bin/openssl /usr/bin/openssl.OFF

mv /usr/include/openssl /usr/include/openssl.OFF
   ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
   ln -s /usr/local/ssl/include/openssl /usr/include/openssl

#配置搜索文件路径
   echo "/usr/local/ssl/lib" >> /etc/ld.so.conf

ldconfig -v
    #查看当前版本

root@localhost tools]# openssl version -a
OpenSSL 1.0.1g 7 Apr 2014
built on: Tue Apr 1 16:34:18 EDT 2014
platform: dist
options: bn(32,32) rc4(ptr,int) des(ptr,risc1,16,long) idea(int) blowfish(idx)
compiler: cc -O
OPENSSLDIR: "/usr/local/ssl"

至此升级OK了~