1.安装工具和依赖包
yum install unzip
yum -y install gcc gcc-c++
2.创建软件安装目录
mkdir /usr/local/{apr,apr-util,apr-iconv,httpd}
3.解压软件文件
tar -zxvf httpd.tar.gz
tar -zxvf apr.tar.gz
tar -zxvf apr-iconv.tar.gz
tar -zxvf apr-util.tar.gz
tar -zxvf pcre.tar.gz
4.编译安装
./configure --prefix=/usr/local/apr
make
make install
在执行configure可能会出现
rm: cannot remove `libtoolT': No such file or directory错误信息。
网上查阅了一下资料,提示编辑configure这个文件,将 $RM “$cfgfile” 那行注释掉 ,然后重新编译即可。
./configure --prefix=/usr/local/pcre
make
make install
简洁安装
将apr-1.5.2与apr-util-1.5.4重命名为apr和apr-util复制到apache源代码srclib目录下
mv apr apr-util httpd/srclib
./configure prefix=/usr/local/httpd --with-pcre=/usr/local/pcre/bin/pcre-config --with-included-apr --enable-so
make
make install
5.验证安装是否成功
cd /usr/local/httpd
./apachectl -k start
6.添加开机启动
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
打开 vi /etc/rc.d/init.d/httpd
在#!/bin/sh 下面加上
#chkconfig: 2345 10 90
#description: Activates/Deactivates Apache Web Server
chkconfig --add httpd
chkconfig httpd on
7.apache编译选项
--enable-socache-memcache memcache small object cache provider
--enable-socache-dc distcache small object cache provider
--enable-so DSO capability. This module will be automatically
enabled unless you build all modules statically.
--enable-watchdog Watchdog module
--enable-macro Define and use macros in configuration files
--enable-dbd Apache DBD Framework
--enable-bucketeer buckets manipulation filter. Useful only for
developers and testing purposes.
--enable-dumpio I/O dump filter
--enable-echo ECHO server
--enable-example-hooks Example hook callback handler module
--enable-case-filter Example uppercase conversion filter
--enable-case-filter-in Example uppercase conversion input filter
--enable-example-ipc Example of shared memory and mutex usage
--enable-buffer Filter Buffering
--enable-data RFC2397 data encoder