Ubuntu Linux 上安装Apache的过程

我到亲身体验:

主要过程遵循http://httpd.apache.org/docs/current/install.html上所述。
1. 从这里http://httpd.apache.org/download.cgi下载最新到Apache server的source code,我下载到是httpd-2.4.3.tar.gz的source code。
2. 验证下载到完整性(我忽略了)
3. 启动系统到Root Terminal
4. 敲入cd Downloads 到httpd-2.4.3.tar.gz所在目录。(它被下载到我到Downloads文件夹中)
5. 敲入gzip -d httpd-2.4.3.tar.gz将其解压为httpd-2.4.3.tar。(在同一目录下)
6. 敲入tar xvf httpd-2.4.3.tar将其解压为httpd-2.4.3。
7. Configuring the source code: 首先cd httpd-2.4.3进入被解压的目录,然后键入./configure,表示用默认到设置。
8. 然而出现一个错误提示我 “error: APR not found. Please read the documentation.” 于是我google了一下,发现这篇文章http://stackoverflow.com/questions/9436860/apache-httpd-setup-and-installation。
8.1 按照这篇文章到解释我从http://apr.apache.org/download.cgi下载了apr-1.4.6.tar.gz和apr-util-1.5.1.tar.gz。
8.2 然后cd到Downloads目录,用gzip和tar命令将它们解压。
8.3 cp -r apr-1.4.6 httpd-2.4.3/srclib/apr
8.4 cp -r apr-util-1.5.1 httpd-2.4.3/srclib/apr-util
9. 重新运行./configure
10. 结果依然有错,提示我error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
11. http://stackoverflow.com/questions/10663180/http-install-error-in-libpcre
12. 从ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 下载pcre-8.30.tar.gz
13. 用gzip和tar解压。
14. 然后 进入pcre-8.30文件夹,cd pcre-8.30
15. 运行 ./configure
16. sudo make编译pcre
17. sudo make install
18. 用cd命令回到 httpd-2.4.3目录。
19. ./configure
20. make
21. make install
22. 安装成功后Apache被安装在/usr/local/apache2中。
23. 进入这个目录。
24. 然后cd bin进入bin目录。
25. 运行 ./apachectl -k start
26. 结果出现错误error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
27. 然后网上搜索,发现这篇文章http://www.cnblogs.com/eastson/archive/2012/06/25/2561575.html
28. 在/etc/ld.so.conf.d目录下新建文件libc.conf,将/usr/local/lib目录加到该文件:用touch libc.conf命令创建,然后用gedit libc.conf修改它。
29. 执行ldconfig命令。
30. 回到/usr/local/apache2目录,执行ldd httpd去测试libpcre.so.1是否已找到。显示结果已经找到。
31. 运行./apachectl -k start
32. 打开chrome, 键入http://localhost, 显示 “It Works!”

posted @ 2013-03-26 20:55  Allan_Dragoon  阅读(329)  评论(0编辑  收藏  举报