Centos7.4升级openssl和apache
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7.4升级openssl和apache相关的知识,希望对你有一定的参考价值。
#!/bin/bash
. /etc/init.d/functions
rpm_openssh="openssl-1.1.1a.tar.gz"
rpm_apr="apr-1.4.5.tar.gz"
rpm_apr_utils="apr-util-1.3.12.tar.gz"
pcre_devel="pcre-8.10.zip"
http_devel="httpd-2.4.37"
src_path=/server/tools
dst_path=/usr/local/src/
openssl(){
cp -arp ${src_path}/$rpm_openssh $dst_path
cd $dst_path && {
tar xf $rpm_openssh
cd openssl-1.1.1a && ./config shared zlib && make && make install
}
if [ $? -eq 0 ]
then
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 -v
sleep 2
ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
else
exit 2
fi
if [ "/usr/local/bin/openssl version|awk ‘{print $2}‘
" == "1.1.1a" ]
then
action "openssl ok" /bin/true
else
action "openssl ok" /bin/false
fi
}
apr_install(){
cd $src_path
tar xf $rpm_apr && {
cd apr-1.4.5 && ./configure --prefix=/usr/local/apr && make && make install
sleep 1
}
}
apr_utils_install(){
cd $src_path
tar xf $rpm_apr_utils && {
cd apr-util-1.3.12 && ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config --enable-utf8 && make && make install
sleep 1
}
}
pcre_install(){
cd $src_path
unzip -o $pcre_devel && {
cd pcre-8.10 && ./configure --prefix=/usr/local/pcre && make && make install
sleep 1
}
}
apache_install(){
cd ${src_path}/$http_devel && {
./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre && make && make install
}
sleep 1
systemctl stop httpd
for i in rpm -qa|grep httpd
;do rpm -e $i --nodeps;sleep 1;done
sleep 2
if [ "/usr/local/apache2/bin/apachectl -v|sed -n 1p|awk -F "[ /]" ‘{print $4}‘
" == "2.4.37" ]
then
action "apache2 is well" /bin/true
else
action "apache2 is well" /bin/false
fi
}
install_openssl(){
if [ rpm -qa|grep zlib-devel|wc -l
-ge 1 ]
then
action "zlib-devel is exist" /bin/true
openssl
else
action "zlib-devel is exist" /bin/false
fi
}
#install_openssl
apr_install
apr_utils_install
pcre_install
apache_install
以上是关于Centos7.4升级openssl和apache的主要内容,如果未能解决你的问题,请参考以下文章