源码安装Apache
环境准备
准备安装包 百度云盘:http://pan.baidu.com/s/1bnL31c7
Apache版本
依赖包
apr-1.5.2.tar.gz
apr-util-1.5.4.tar.gz
pcre-8.37.tar.gz
2.安装依赖包
安装apr,apr-util,pcre依赖包
开始安装依赖边,注意,需要将解压包放到apache的srclib目录下面也就是这里的/soft/httpd-2.4.16/srclib/
源码安装三步走
解压
安装
编译
安装apr
[root@localhost soft]# cd /soft/httpd-2.4.16/srclib/
[root@localhost srclib]# tar -zxvf apr-1.5.2.tar.gz
解压
[root@localhost srclib]# mv apr-1.5.2 apr
[root@localhost srclib]# cd apr
[root@localhost apr]# ./configure --prefix=/usr/local/apr 安装
[root@localhost apr]# make && make install 编译
安装apr-util
[root@localhost srclib]# tar -zxvf apr-util-1.5.4.tar.gz
[root@localhost srclib]# mv apr-util-1.5.4 apr-util
[root@localhost srclib]# cd apr-util
[root@localhost apr-util]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
[root@localhost apr-util]# make && make install
安装pcre
[root@localhost srclib]# tar -zxvf pcre-8.37.tar.gz
[root@localhost srclib]# mv pcre-8.37 pcre
[root@localhost pcre-8.37]# ./configure --prefix=/usr/local/pcre
[root@localhost pcre-8.37]# make && make install
3.接下来开始安装Apache源码包
[root@localhost soft]#tar -zxvf
httpd-2.4.16.tar.gz
[root@localhost soft]# cd httpd-2.4.16
[root@localhost soft]# ./configure --prefix=/usr/local/apache2 --sysconfdir=/etc/httpd --with-z=/usr/local/zlib/ --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
[root@localhost soft]# make && make install
4.启动apache服务
[root@localhost ~]# /usr/local/apache2/bin/apachectl startnetstat -na|grep 80
5.注册为服务
[root@localhost ~]# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd [root@localhost ~]# service httpd starthttpd (pid 45005) already running
6.加入到chkconfig
进入/etc/init.d/httpd,加入# chkconfig: 345 61 61# description:Apache httpd [root@localhost ~]# chkconfig --add httpd [root@localhost ~]# chkconfig httpd on
打开网页,输入http://ip,浏览看看,显示It works!就说明apache安装成功了
本文出自 “岁寒,然后知松柏之后凋也” 博客,请务必保留此出处http://endmoon.blog.51cto.com/10533729/1733451
原文:http://endmoon.blog.51cto.com/10533729/1733451