1. 源码包下载
Apache Http安装要求必须安装APR、APR-Util、PCRE等包。
Apache Http包下载地址:http://httpd.apache.org/download.cgi
APR和APR-Util包下载地址:http://apr.apache.org/download.cgi
PCRE包下载地址:http://sourceforge.net/projects/pcre/files/pcre/
2. 安装APR和APR-Util
先安装APR,
$ tar -zxf apr-1.5.2.tar.gz $ cd apr-1.5.2 $ sudo mkdir -p /usr/local/apr $ ./configure --prefix=/usr/local/apr $ make $ sudo make install
APR安装完成之后,安装APR-Util,
$ tar -zxf apr-util-1.5.4.tar.gz $ cd apr-util-1.5.4 $ sudo mkdir -p /usr/local/apr-util $ ./configure --prefix=/usr/local/apr-util --with-apr= /usr/local/apr/bin/apr-1-config $ make $ sudo make install
3. 安装PRCE包
运行下面命令安装PRCE包,
$ tar -zxf pcre-8.37.tar.gz $ cd pcre-8.37 $ sudo mkdir -p /usr/local/pcre $ ./configure --prefix=/usr/local/pcre --with-apr=/usr/local/apr/bin/apr-1-config $ make $ sudo make install
4. 安装Apache Http Server服务
运行下面命令安装Apache Http Server服务,
$ sudo mkdir -p /usr/local/apache $ tar zxvf httpd-2.2.31.tar.gz $ cd httpd-2.2.31/ $ ./configure --prefix=/usr/local/apache --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util $ make $ sudo make install
5. 验证
经过上面的步骤,我们已经将Apache http server成功安装在/usr/local/apache目录下,其配置文件httpd.conf默认在/usr/local/pache/conf目录下。我们现在采用默认的配置进行验证,通过下面命令启动Apache http服务,
$ sudo /usr/local/apache/bin/apachectl start
然后在浏览器中输入http://127.0.0.1/即可得到如下页面表示成功了。
(done)