当前位置: > Linux服务器 > SSL >

shell自动升级openssl到openssl 1.0.1g

时间:2014-12-12 02:04来源:linux.it.net.cn 作者:IT
本来打算早点写这个openssl自动升级脚本的,没想到被人捷足先登,好吧,那我也就只能再加上点我认为必要的东西上去了.
  系统:centos 5.x
openssl升级脚本内容:
cat openssl_update.sh
 
01 #!/bin/bash
02 if [[ $EUID -ne 0 ]]; then
03    echo "This script must be run as root" 1>&2
04    exit 1
05 fi
06 yum -y install glibc* cpp gcc* make zlib ntp wget
07 ntpdate time.nist.gov
08 hwclock -w
09 wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz
10 file=`find / -name openssl-1.0.1g.tar.gz|wc -l`
11 if [[ $file = 1 ]];then
12 tar zxf openssl-1.0.1g.tar.gz && cd openssl-1.0.1g
13 ./config shared zlib
14 #./config --prefix=/usr/local/ssl shared zlib-dynamic enable-camellia -DOPENSSL_NO_HEARTBEATS
15 make && make install
16 cd /usr/local/ssl/
17 ./bin/openssl version
18 mv /usr/bin/openssl /usr/bin/openssl.old
19 mv /usr/include/openssl /usr/include/openssl.old
20 ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
21 ln -s /usr/local/ssl/include/openssl/ /usr/include/openssl
22 echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
23 ldconfig
24 ldconfig -v|grep ssl
25 else
26   echo "file is not found!"
27   exit 1
28 fi


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