环境:Centos 7.2.1511
安装包:
1> httpd-2.4.18.tar.gz(http://httpd.apache.org/download.cgi#apache24)
2> apr-1.5.2.tar.gz(http://apr.apache.org/)
3> apr-util-1.5.4.ta.gz(http://apr.apache.org/)
4> pcre-8.38.tar.gz(ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/)
安装:
$: tar xzf httpd-2.4.18.tar.gz
$: cd httpd-2.4.18
$: ./configure --prefix=/usr/local/apache2 //安装目录
$: make
$: sudo make install
问题:
1.缺少apr,apr-util
$:tar xzf apr-1.5.2.tar.gz
$:tar xzf apr-util-1.5.4.ta.gz
$:mv apr-1.5.2 httpd-2.4.18/srclib/apr
$:mv apr-util-1.5.4 mv apr-1.5.2 httpd-2.4.18/srclib/apr-util
$:cd httpd-2.4.18
$:./configure --prefix=/usr/local/apache2 --with-included-apr --with-included-apr-util
2 缺少 gcc 和 c++
$: sudo yum install gcc
$: sudo yum install gcc-c++
3 找不到 pcre-config
$:tar xzf pcre-8.38.tar.gz
$:cd pcre-8.38
$:./configure --prefix=/usr/local/pcre
#:make && make install
$:cd httpd-2.4.18
$:./configure --prefix=/usr/local/apache2 --with-included-apr --with-included-apr-util --with=pcre=/usr/local/pcre
测试:
$:cd /usr/local/apache2/bin
$:sudo ./apachectl -k start
ps: apachectl 与 httpd 等同
问题:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
在 /usr/local/apache2/conf/httpd.conf 文件中找到 ServerName 处,改成ServerName=localhost:80
链接:
$: sudo ln -s /usr/local/apache2/httpd -t /usr/local/bin