注:这个脚本在 centos7.3 7.9 上面测试过,
测试的虚拟机是处于 cenos刚安装完系统,的快照下测试的
还有一个待补充的是 配置httpd-2.4.46 时候,的具体每一项配置或者可以去 gitee 直接
git clone
https://gitee.com/qt986/shell/blob/master/centos/apache_2.4.46_tar.sh
#!/bin/bash# httpd-2.4.46# create apache filesmkdir /usr/src/apache_tar_gzhttpd1="/usr/src/apache_tar_gz"# centos yi_laiyum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel axel expat-devel# install aprcd $httpd1#wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.gzaxel -n 16 https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.gztar zxf apr-1.7.0.tar.gzcd ./apr-1.7.0./configure --prefix=/usr/local/aprmake && make install# install apr-utilcd $httpd1#wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gzaxel -n 16 https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gztar zxf apr-util-1.6.1.tar.gzcd ./apr-util-1.6.1./configure --prefix=/usr/local/apr-util \ --with-apr=/usr/local/aprmake && make install# install zlibcd $httpd1#wget https://zlib.net/fossils/zlib-1.2.11.tar.gzaxel -n 20 https://zlib.net/fossils/zlib-1.2.11.tar.gztar zxf zlib-1.2.11.tar.gzcd ./zlib-1.2.11./configure --prefix=/usr/local/zlibmake && make install# install pcrecd $httpd1#wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gzaxel -n 16 https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gztar zxf pcre-8.44.tar.gzcd ./pcre-8.44./configure --prefix=/usr/local/pcremake && make install# install opensslcd $httpd1#wget https://ftp.openssl.org/source/openssl-1.1.1j.tar.gzaxel -n 16 https://ftp.openssl.org/source/openssl-1.1.1j.tar.gztar zxf openssl-1.1.1j.tar.gzcd ./openssl-1.1.1j./configure -fPIC --prefix=/usr/local/openssl enable-sharedmake && make install# install httpdcd $httpd1#wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.46.tar.gzaxel -n 16 https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.46.tar.gztar zxf httpd-2.4.46.tar.gzcd ./httpd-2.4.46cp -r ../apr-1.7.0 srclib/aprcp -r ../apr-util-1.6.1 srclib/apr-util./configure --prefix=/usr/local/httpd \ --enable-so \ --enable-cgi \ --enable-cgid \ --enable-ssl \ --with-ssl=/usr/local/openssl \ --enable-rewrite \ --with-pcre=/usr/local/pcre \ --with-z=/usr/local/zlib \ --with-apr=/usr/local/apr \ --with-apr-util=/usr/local/apr-util \ --enable-modules=most \ --enable-mods-shared=most \ --enable-mpms-shared=all \ --with-mpm=event \ --enable-proxy \ --enable-proxy-fcgi \ --enable-expires \ --enable-deflate \ --with-included-aprmake && make install# ln -s /usr/local/httpd/bin/* /usr/local/bincp /usr/local/httpd/bin/apachectl /etc/init.d/httpdecho "# chkconfig: 35 85 85# description: apache 2.4.46" >> /etc/init.d/httpdchkconfig --add httpdecho "__end__"