编译环境
操作系统:
Red Hat Enterprise Linux Server release 5.4 64-bit
编译工具:
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)
1.
下载zlib库
以
zlib-1.2.7.tar.gz
包为例,将
zlib-1.2.7.tar.gz
上传至/home目录下
2.
编译安装zlib库
$
cd /home
$
tar -zxvf
zlib-1.2.7.tar.gz
$
cd zlib-1.2.7
$
./configure --prefix=/usr/local
$
make
&&
make install
&&
make clean
3.
下载
OpenSSL
地址:
http://www.openssl.org/source
/
以
openssl-1.0.1c.tar.gz
包为例,将
openssl-1.0.1c.tar.gz
上传至/home目录下
4.
解压OpenSSL
$
cd /home
$
tar -zxvf openssl-1.0.1c.tar.gz
$
cd openssl-1.0.1c
5.
编译并安装
编译
$
./config enable-shared --prefix=/usr/local/openssl/ --openssldir=/usr/local/ssl/zlib
$
make
&&
make test
&& make install
清理编译时的中间文件
$
make clean
6.
使用
在/usr/local/openssl/lib中存放的生成的openssl库
libcrypto
.a和
libssl.a
,可以直接用来参与静态编译