升级Openssl
#!/bin/bash
OPENSSL='openssl-1.0.2u.tar.gz'
CD_OPENSSL='openssl-1.0.2u'
wget_ssl() {
yum -y install wget >/dev/null 2>&1
wget -P /tmp/ 10.161.12.246/openssh/"$OPENSSL" >/dev/null 2>&1
if [ $? -ne 0 ];then
echo "$OPENSSL file down load error"
exit 1
fi
}
linux7_install_Packages() {
mkdir /etc/yum.repos.d/bak >/dev/null 2>&1
yes | mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
cat <<EOF > /etc/yum.repos.d/cBSS-7.repo
[cBSS-7]
name=cBSS-7
baseurl=http://10.161.12.246/redhat7.7
enable=1
gpgcheck=0
EOF
yum clean all >/dev/null 2>&1
yum makecache >/dev/null 2>&1
yum -y install gcc-c++ zlib-devel pam-devel zlib perl-CPAN >/dev/null 2>&1
if [ $? -ne 0 ];then
echo 'install Packages failed7'
exit 1
fi
}
linux6_install_Packages() {
mkdir /etc/yum.repos.d/bak >/dev/null 2>&1
yes | mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
cat <<EOF > /etc/yum.repos.d/cBSS-6.repo
[cBSS-6]
name=cBSS-6
baseurl=http://10.161.12.246/redhat6.10
enable=1
gpgcheck=0
EOF
yum clean all >/dev/null 2>&1
yum makecache >/dev/null 2>&1
yum -y install gcc-c++ zlib-devel pam-devel zlib perl-CPAN >/dev/null 2>&1
if [ $? -ne 0 ];then
echo 'install Packages failed6'
exit 1
fi
}
install_ssl(){
tar -xf /tmp/"$OPENSSL" -C /tmp
cd /tmp/"$CD_OPENSSL"
./config --prefix=/usr/local/openssl threads zlib shared enable-camellia >/dev/null 2>&1
if [ $? -eq 0 ];then
echo 'configure sucess'
make >/dev/null 2>&1 && make install >/dev/null 2>&1
if [ $? -eq 0 ];then
echo 'make sucess'
chmod 755 /usr/local/openssl/ -R
mv /usr/bin/openssl /usr/bin/openssl.bak
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
echo "/usr/local/openssl/lib">>/etc/ld.so.conf
ldconfig
openssl version
else
echo 'make failed'
exit 1
fi
else
echo 'configure failed'
exit 1
fi
}
release=`cat /etc/redhat-release 2>&1 | grep '7' | wc -l`
if [ -e /etc/redhat-release ]; then
if [ $release == 1 ];then
wget_ssl
linux7_install_Packages
install_ssl
else
wget_ssl
linux6_install_Packages
install_ssl
fi
else
echo 'This system not REDHAT 6 and 7'
exit 1
fi