httpd-2.4.46 (apache) 基于网络源码包安装

注:这个脚本在 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 files
mkdir  /usr/src/apache_tar_gz
httpd1="/usr/src/apache_tar_gz"

# centos yi_lai
yum -y install make gcc gcc-c++ kernel-devel m4  ncurses-devel openssl-devel axel expat-devel

# install apr
cd $httpd1
#wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.gz
axel -n 16 https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.gz
tar zxf apr-1.7.0.tar.gz
cd ./apr-1.7.0
./configure --prefix=/usr/local/apr
make && make install

# install apr-util
cd $httpd1
#wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
axel -n 16 https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
tar zxf apr-util-1.6.1.tar.gz
cd ./apr-util-1.6.1
./configure --prefix=/usr/local/apr-util \
  --with-apr=/usr/local/apr
make && make install

# install zlib
cd $httpd1
#wget https://zlib.net/fossils/zlib-1.2.11.tar.gz
axel -n 20 https://zlib.net/fossils/zlib-1.2.11.tar.gz
tar zxf zlib-1.2.11.tar.gz
cd ./zlib-1.2.11
./configure --prefix=/usr/local/zlib
make && make install

# install pcre
cd $httpd1
#wget https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
axel -n 16 https://ftp.pcre.org/pub/pcre/pcre-8.44.tar.gz
tar zxf pcre-8.44.tar.gz
cd ./pcre-8.44
./configure --prefix=/usr/local/pcre
make && make install

# install openssl
cd $httpd1
#wget https://ftp.openssl.org/source/openssl-1.1.1j.tar.gz
axel -n 16 https://ftp.openssl.org/source/openssl-1.1.1j.tar.gz
tar zxf openssl-1.1.1j.tar.gz
cd ./openssl-1.1.1j
./configure -fPIC --prefix=/usr/local/openssl enable-shared
make && make install

# install httpd
cd $httpd1
#wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.46.tar.gz
axel -n 16 https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.46.tar.gz
tar zxf httpd-2.4.46.tar.gz
cd ./httpd-2.4.46
cp -r ../apr-1.7.0 srclib/apr
cp -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-apr
make && make install

# 
ln -s /usr/local/httpd/bin/* /usr/local/bin

cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
echo "# chkconfig: 35 85 85
# description: apache 2.4.46" >> /etc/init.d/httpd
chkconfig --add httpd

echo "__end__"
上一篇:《剑指 offer》 学习46之圆圈中最后剩下的数


下一篇:46. DDR2内存初始化代码分析-9