安装前准备
编译需要
yum install pam pam-devel gcc-c++ zlib-devel perl-IPC-Cmd
源码下载地址
https://www.openssl.org/source/
启动xinetd服务
此服务仅限于临时用,作为升级完后重启失败时备选登录远程服务器,注意使用完及时停止服务
service xinetd start
创建变量,当前日期
currdate=$(date +%Y%m%d%H%M)
确认下是否创建成功
echo $currdate
备份之前安装
mv /usr/local/openssl /usr/local/openssl_$currdate
解压openssl软件包
tar vxf openssl-XXXXXX.tar.gz
进入openssl目录
cd openssl-XXXXXX
编译配置
openssl
将会安装在/usr/local/openssl
./config --prefix=/usr/local/openssl
编译
make
安装
make install
配置到共享库
vim /etc/ld.so.conf
追加内容:
/usr/local/openssl/lib64
加载生效:
ldconfig
备份之前的版本
mv /usr/bin/openssl /usr/bin/openssl_$currdate
mv /usr/include/openssl /usr/include/openssl_$currdate
下面这些文件如果不拷贝,编译某些软件报错ERROR: OpenSSL Crypto development libraries are not installed properly in required location. Abort.
。
mv /usr/lib64/pkgconfig/libcrypto.pc /usr/lib64/pkgconfig/libcrypto.pc_$currdate
mv /usr/lib64/pkgconfig/libssl.pc /usr/lib64/pkgconfig/libssl.pc_$currdate
mv /usr/lib64/pkgconfig/openssl.pc /usr/lib64/pkgconfig/openssl.pc_$currdate
将新版本替换掉老版本
cp /usr/local/openssl/bin/openssl /usr/bin/openssl
cp -rfvp /usr/local/openssl/include/openssl /usr/include/openssl
cp -rfvp /usr/local/openssl/lib/pkgconfig/* /usr/lib64/pkgconfig/
此处可能因版本而异
最后运行
openssl version
查看是否升级成功
回退
rm -rf /usr/bin/openssl
rm -rf /usr/include/openssl
mv /usr/bin/openssl_$currdate /usr/bin/openssl
mv /usr/include/openssl_$currdate /usr/include/openssl
mv /usr/lib64/pkgconfig/libcrypto.pc_$currdate /usr/lib64/pkgconfig/libcrypto.pc
mv /usr/lib64/pkgconfig/libssl.pc_$currdate /usr/lib64/pkgconfig/libssl.pc
mv /usr/lib64/pkgconfig/openssl.pc_$currdate /usr/lib64/pkgconfig/openssl.pc
参考
https://www.cnblogs.com/haoee/p/17391596.html
标签:pkgconfig,pc,OpenSSL,openssl,编译,currdate,usr,3.0,lib64 From: https://www.cnblogs.com/snowsolf/p/18530641