1)、下载httpd软件包和解压
cd /usr/local/src wget http://apache.opencas.org//httpd/httpd-2.4.18.tar.gz tar zxvf httpd-2.4.18.tar.gz
2)、安装前的系统需求:
(1)APR and APR-Util
cd /usr/local/src wget http://apache.opencas.org//apr/apr-1.5.2.tar.gz wget http://apache.opencas.org//apr/apr-util-1.5.4.tar.gz tar zxvf apr-1.5.2.tar.gz tar zxvf apr-util-1.5.4.tar.gz mv /usr/local/src/apr-1.5.2 /usr/local/src/httpd-2.4.18/srclib/apr mv /usr/local/src/apr-util-1.5.4 /usr/local/src/httpd-2.4.18/srclib/apr-util
(2)PRCE
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz tar zxvf pcre-8.3.7.tar.gz cd pcre-8.3.7 ./configure make && make install
(3)GCC和各种编译工具
yum install make apr* autoconf automake gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch
3)、安装Apache
mkdir -p /usr/local/apache24 cd /usr/local/src/httpd-2.4.18 ./configure --prefix=/usr/local/apache24 --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared--with-pcre make && make install
4)、启动
/usr/local/apache24/bin/apachectl -k start
参考:https://httpd.apache.org/docs/2.4/install.html
时间: 2024-12-28 17:57:51