1、下载apache
wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.10.tar.gz
wget http://archive.apache.org/dist/apr/apr-1.5.1.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz
2、安装所需组件
yum -y install libtool lynx
3、安装apr
tar zxvf apr-1.5.1.tar.gz
cd apr-1.5.1
vi configure
找到RM=‘$RM‘修改为RM=‘$RM -f‘ 保存
./configure --prefix=/usr/local/apr
make&make install
4、安装 apr-util
tar zxvf apr-util-1.3.12.tar.gz
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make&make install
5、安装pcre
tar zxvf pcre-8.35.tar.gz
cd pcre-8.35
./configure --prefix=/usr/local/pcre
make&make install
6、安装httpd
tar zxvf httpd-2.4.10.tar.gz
cd httpd-2.4.10
./configure --prefix=/usr/local/httpd --enable-so --enable-mods-shared=all --enable-rewrite=shared --enable-speling=shared --with-apr=/usr/local/apr/bin/apr-1-config --with-pcre=/usr/local/pcre/ --with-apr-util=/usr/local/apr-util/
make&make install
7、注册apache服务
cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpd
service httpd restart
8、添加开机启动
vi /etc/init.d/httpd 在#!/bin/sh 下增加以下两行文字
# chkconfig: 35 70 30
# description: Apache
chkconfig -add httpd
chkconfig httpd on
9、修改servername
vi /usr/local/httpd/conf/http.conf
找到#ServerName www.example.com:80去掉前面的#保存
10、访问http://ip 会显示 It‘s work!说明安装成功。
本文出自 “linux相关分享” 博客,请务必保留此出处http://2860664.blog.51cto.com/2850664/1554699
原文地址:http://2860664.blog.51cto.com/2850664/1554699