标签:安装apache教程
1)下载apache 所需的安装包(apr-1.5.2.tar.gz 、apr-util-1.5.4.tar.gz、httpd-2.4.16.tar.gz)
[root@xiaoyi tmp]# wget http://mirrors.axint.net/apache//httpd/httpd-2.4.16.tar.gz
[root@xiaoyi tmp]# wget http://mirrors.axint.net/apache//apr/apr-1.5.2.tar.gz
[root@xiaoyi tmp]# wget http://mirrors.axint.net/apache//apr/apr-util-1.5.4.tar.gz
2)解压安装包
[root@xiaoyi tmp]# tar xzvf httpd-2.4.16.tar.gz
[root@xiaoyi tmp]# tar xvzf apr-1.5.2.tar.gz
[root@xiaoyi tmp]# tar xvzf apr-util-1.5.4.tar.gz
3)移动
[root@xiaoyi tmp]# mv apr-1.5.2 httpd-2.4.16/srclib/apr ->httpd-2.4.16/srclib/apr 不能带有版本号
[root@xiaoyi tmp]# mv apr-util-1.5.4 httpd-2.4.16/srclib/apr-util ->httpd-2.4.16/srclib/apr-util 不能带有版本号
4)pcre安装包,在光盘里面可以找到。
[root@xiaoyi Packages]# rpm -ivh pcre-7.8-6.el6.i686.rpm 还有 pcre-devel-7.8-3.1.el6.i686.rpm
5)进入httpd-2.4.16
[root@xiaoyi httpd-2.4.16]# ./configure --prefix=/usr/local/apache --enable-so --enable-deflate=shared --enable-ssl=shared --enable-expires=shared --enable-headers=shared --enable-rewrite=shared --enable-static-support --with-included-apr --with-mpm=prefork
6)编译安装
[root@xiaoyi httpd-2.4.16]# make && make install
7)完成后启动apache
[root@xiaoyi tmp]#/usr/local/apache/bin/apachectl -t 检查语句
Syntax OK
[root@xiaoyi tmp]#/usr/local/apache/bin/apachectl start 启动
[root@xiaoyi tmp]netstat -ntpl | grep ":80"
8)添加apache到系统服务
[root@xiaoyi /]# cp /usr/local/apache/bin/apachectl /etc/init.d/
[root@xiaoyi /]# chmod a+x /etc/init.d/apachectl
[root@xiaoyi /]# vim /etc/init.d/apachectl
#!/bin/sh
#chkconfig:35 61 61
[root@xiaoyi /]# chkconfig --add apachectl
[root@xiaoyi /]# chkconfig --list apachectl
apachectl 0:off 1:off 2:off 3:on 4:off 5:on 6:off
[root@xiaoyi /]# service apachectl stop
[root@xiaoyi /]# service apachectl start
本文出自 “微风清凉” 博客,谢绝转载!
标签:安装apache教程
原文地址:http://jiay1.blog.51cto.com/9144615/1689354