linux中shell自动升级openssl到openssl 1.0.1g

作者:袖梨 2022-11-14

系统:centos 5.x
openssl升级脚本内容:
cat openssl_update.sh

代码如下 复制代码

#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
yum -y install glibc* cpp gcc* make zlib ntp wget
ntpdate time.nist.gov
hwclock -w
wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz
file=`find / -name openssl-1.0.1g.tar.gz|wc -l`
if [[ $file = 1 ]];then
tar zxf openssl-1.0.1g.tar.gz && cd openssl-1.0.1g
./config shared zlib
#./config --prefix=/usr/local/ssl shared zlib-dynamic enable-camellia -DOPENSSL_NO_HEARTBEATS
make && make install
cd /usr/local/ssl/
./bin/openssl version
mv /usr/bin/openssl /usr/bin/openssl.old
mv /usr/include/openssl /usr/include/openssl.old
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
ldconfig -v|grep ssl
else
echo "file is not found!"
exit 1
fi

这样如果有多台(小于等于30台)服务器的话,你就可以传上去让脚本自己跑去,下次再加上批量分发和批量执行脚本就完美了.

感谢夜空 原文来自 http://blog.slogra.com/post-532.html

相关文章

精彩推荐