1 $ cd httpd-NN
2 $ ./configure --prefix=PREFIX
3 $ make
4 $ make install
5 $ vi PREFIX/conf/httpd.conf
6 $ PREFIX/bin/apachectl -k start
如果安装软件都像写的这么简单就好了。不过没有关系,梁任公曾说过这么一句:要是饭都端到嘴边,还有什么意思?
错误1:在 ./configure 步骤时,没有发现APR:
1 ./configre --prefix=/usr/local/apache2 --with-apr=/usr/local/APR
2 checking for APR... no
3 configure: error: APR could not be located. Please use the --with-apr option.
APR是什么呢?官网上面有一个简单的介绍:
The mission of the Apache Portable Runtime (APR) project is to create and maintain software libraries that provide a predictable and consistent interface to underlying platform-specific implementations. The primary goal is to provide an API to which software developers may code and be assured of predictable if not identical behaviour regardless of the platform on which their software is built, relieving them of the need to code special-case conditions to work around or take advantage of platform-specific deficiencies or features.
我想能看完的没几个人,能耐心看完140个字的人都不多了。简单来说,这是Apache安装所要依赖的lib库。APR(Apache portable Run-time libraries,Apache可移植运行库),目的如其名称一样,主要为上层的应用程序提供一个可以跨越多操作系统平台使用的底层支持接口库。
从官网上面下载了APR http://apr.apache.org/ 编译的时候也是和和上面相同的步骤:
$ cd /apr-1.4.6
$ ./configure --prefix=/usr/local/apr
$ make
$ make install
错误2:在 ./configure 步骤时,没有发现APR-Utils:
1 $ ./configre --prefix=/usr/local/apache2 --with-apr=/usr/local/APR
2 $ checking for APR-util... no
3 $ configure: error: APR could not be located. Please use the --with-apr option.
从官网上面下载APR-Util,地址也是一样的 http://apr.apache.org/ 编译安装
1 $ cd /apr-util-1.4.1
2 $ ./configure --prefix=/usr/local/apr-util
3 $ make
4 $ make install
其实这部分我没有太仔细的看APR和APR-Util的关系,既然都需要,为什么没有bind在一起而是要分开安装呢?
错误3:在./configure 步骤时,没有发现PCRE:
1 $ ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/APR --with-apr-util=/usr/local/apache2
2 $ configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
从官网上面下载PCRE,地址在另外一个地方 https://sourceforge.net/projects/pcre/files/pcre/ 编译安装
1 $ cd /pcre-8.30
2 $ ./configure --prefix=/usr/local/pcre
3 $ make
4 $ make install
继续安装Apache