centos7 源码编译安装apache

1、安装apache和php的依赖

yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gd gd-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
**

2、安装apache的依赖apr

tar xf apr-1.5.0.tar.gz
cd apr-1.5.0
./configure --prefix=/usr/local/apr
make && make install

3、安装apache的依赖apr-util

tar xf apr-1.5.0.tar.gz
cd apr-1.5.0
./configure --prefix=/usr/local/apr
make
make install
注意:若出现以下情况说明之前配置过,执行make clean即可,然后重新./configure和make && make install
/bin/sh /usr/local/httpd-2.2.3/srclib/apr/libtool --mode=install /usr/bin/install -c -m 755 libaprutil-1.la /usr/local/apache2/lib
libtool: install: error: cannot install `libaprutil-1.la’ to a directory not ending in /usr/local/apache22/lib
make[2]: *** [install] Error 1
**

4、安装apache的依赖pcre

tar xf pcre-8.39.tar.gz
cd pcre-8.39
mkdir /usr/local/pcre
./configure --prefix=/usr/local/pcre --with-apr=/usr/local/apr/bin/apr-1-config
make && make install
5、安装apache
./configure
–prefix=/usr/local/apache2.4.26
–enable-modules=all
–enable-mods-shared=all
–enable-so
–enable-rewrite
–with-pcre
–enable-ssl
–with-mpm=prefork
–with-pcre=/usr/local/pcre
–with-apr=/usr/local/apr
–with-apr-util=/usr/local/apr-util

make && make install

如遇到以下问题,就是你原来编译过;
make[2]: *** [htpasswd] Error 1
make[2]: Leaving directory /software/httpd-2.4.26/support' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory/software/httpd-2.4.26/support’
make: *** [all-recursive] Error 1
解决:进入到解压目录
cp -r apr-1.6 httpd-2.4/srclib/apr
cp -r apr-util-1.6 httpd-2.4/srclib/apr-util
最后在编译的时候加上–with-included-apr,然后在重新编译

你可能感兴趣的:(centos7 源码编译安装apache)