进入指定目录,下载
cd /usr/local/src
wget http://mirrors.sohu.com/apache/httpd-2.2.31.tar.bz2
解压
tar jxf httpd-2.2.31.tar.bz2
ls
cd httpd-2.2.31 进入目录
ls
vim INSTALL 查看安装文档
指定参数
./configure \
> --prefix=/usr/local/apache2 \ 指定路径
> --with-included-apr \ 安装依赖apr
> --enable-so \ 动态共享安装
> --enable-deflate=sharede \
> --enable-expires=sharede \
> --enable-rewrite=sharede \
> --with-pcre 正则库
echo$!检查是否为0,正常。
为了避免在make的时候出现错误,所以最好是提前先安装好一些库文件:
yum install -y pcre pcre-devel apr apr-devel error: mod_deflate has been requested but can not be built due to prerequisite failures 解决办法是: yum install -y zlib-devel
4.make
echo $!
5.make install
echo $!
6./usr/local/apache/bin/apchectl start 启动apache
7.检验
ps aux |grep httpd
netstat -lnp
8./usr/local/apqche/bin/apachectl -M 显示模块 -t 检查错误 restart 重启 stop 停止