1.http://httpd.apache.org/,下载压缩文件

2.tar -xvzf httpd-2.4.18.tar.gz

3.cd httpd-2.4.18/

4../configure

5.wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz

6.wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz

7.tar -xvzf apr-1.4.5.tar.gz

8.tar -xvzf apr-util-1.3.12.tar.gz

9.cd apr-1.4.5/

10. ./configure

11.make

12.make install

13.cd ..

14.cd apr-util-1.3.12/

15. ./configure --with-apr=/usr/local/apr/

16.make

17.make install

安装pcre

18.cd ../httpd-2.4.18/

19. ./configure

20.make

21.make install

22.cd /usr/local/apache2/bin

23. ./apachectl -k start

报错

24.cd ../conf

25.vi httpd.conf

将里面的 #ServerName www.example.com:80 注释去掉即可,www.example.com换成localhost

26.cd /usr/local/apache2/bin

27. ./httpd


在多ip时,需要设置ip: 

/usr/local/apache2/conf# vi httpd.conf

ServerName 5.5.5.1:80


在安装目录的httpd.conf中找到DocumentRoot "/usr/local/apache2/htdocs",这就是放置index.html等文件的地方。

当然,这是最简单的安装。其他配置如果需要再配置。

apache官网