Ubuntu搭建LAMP环境(安装新版本的Apache服务器)出现问题,执行配置安装httpd时出错

继续在ubuntu下配置PHP开发环境,做到安装Apache服务器了,执行configure的时候,报错,具体如下

configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.

google以后,发现这是需要下载apr和apr-utils 并解压到./srclib/, 再进行编译。

解决办法:

1.1 在上面的链接或者网上下载 apr-1.4.6.tar.gz和apr-util-1.4.1.tar.gz,放到/usr/local/src/目录下,解压软件包到当前目录的apr-1.4.6/和apr-util-1.4.1/下,命令如下:
$ cd /usr/local/usr/                                      // 进入源码包所在目录
$ sudo tar zxvf apr-1.4.6.tar.gz                  // 解压缩
$ sudo tar zxvf apr-util-1.4.1.tar.gz           // 解压缩

1.2 (现在我们依然在/usr/local/src/目录下)拷贝解压缩后的目录到httpd-2.4.4/srclib/apr和httpd-2.4.4/srclib/apr-util中,命令如下:
$ sudo cp -rf apr-1.4.6 httpd-2.4.4/srclib/apr
$ sudo cp -rf apr-util-1.4.1 httpd-2.4.4/srclib/apr-util

然后重新进入httpd目录,进行配置。

结果出现新的问题,如下:
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

又是一个依赖关系,,,,晕死算了。没办法,继续下吧。去http://pcre.org/下载

2.1 在上面的链接或者网上下载 pcre-8.32.tar.gz,放到/usr/local/src/目录下,解压软件包到当前目录的pcre-8.32下,并进入pcre-8.32目录,命令如下:
$ cd /usr/local/usr/                                      // 进入源码包所在目录
$ sudo tar zxvf pcre-8.32.tar.gz                  // 解压缩
$ cd pcre-8.32                                               // 进入目录

2.2 使用“configure”命令检查并配置安装需要的系统环境,并生成安装配置文件,命令行如下:
$ ./configure –prefix=/usr/local/pcre
选项–prefix=/usr/local/pcre作用,是在安装时将软件安装到/usr/local/pcre目录下

2.3 使用make命令编译源码文件并生成安装文件,命令如下:
$ sudo make                                                    // 编译

2.4 使用make install命令进行安装,命令如下:
$ sudo make install                                         // 安装
如果安装成功就会在/usr/local/pcre目录下生成bin、include、lib和share四个目录。如下图
Selection_120

安装完pcre以后,回到httpd目录下,

在./configure的时候加上–with-pcre=/usr/local/pcre即可。

这次终于成功configure了,然后make && make install。

大功告成!

————————————-华丽丽的分割线,下面是英语版——————————————–

English Version:

Continue to install the PHP environment.
An error occured when performing configure command during installing Apache server:

configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.

Google it, I found that we need to download the apr and apr-utils , extract them to ./srclib/ and then compile.

Solution:

1.1 Download the file apr-1.4.6.tar.gz and apr-util-1.4.1.tar.gz on the above link or the official site, put them under /usr/local/src/, and extract them separately to apr-1.4.6/ and apr-util-1.4.1/. The commands as follows:

$ cd /usr/local/usr/            // enter the directory where the source code is
$ sudo tar zxvf apr-1.4.6.tar.gz           // extract the file
$ sudo tar zxvf apr-util-1.4.1.tar.gz      // extract the file

1.2 (remain under the /usr/local/src/)copy the extracted files above separately to directory httpd-2.4.4/srclib/apr/ and httpd-2.4.4/srclib/apr-util/, commands as follows:
$ sudo cp -rf apr-1.4.6 httpd-2.4.4/srclib/apr
$ sudo cp -rf apr-util-1.4.1 httpd-2.4.4/srclib/apr-util

enter the httpd directory to configure.

Another new problem arised:
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

Another dependency?? oops… continue to download~~ go to the website http://pcre.org/.

2.1 Download the file pcre-8.32.tar.gz on the above link or the official site, put it under /usr/local/src/, and extract it to pcre-8.32/, and enter the current directory. The commands as follows:
$ cd /usr/local/usr/            // enter the directory where the source code is
$ sudo tar zxvf  pcre-8.32.tar.gz          // extract the file
$ cd pcre-8.32/                              // enter the current directory

2.2 Check and configure the installation environment with “configure” command, which will generate installation configuration file.  The command line as follows:
$ ./configure –prefix=/usr/local/pcre
“–prefix=/usr/local/pcre” means that the installing software will be installed under /usr/local/pcre.

2.3 use the make command to compile the source file and generate the installation file:
$sudo make                                                      // compile

2.4 use command make install to install:
$ sudi make install                                              // install
If the installation succeeded, there would be four directories(bin/, include/, lib/, share/)generated under /usr/local/pcre, as following picture:

Selection_120

after installing the pcre, return to the httpd directory, and add the option –with-pcre=/usr/local/pcre behind ./configure.

It succeeded~~, and then perform make and make install.
Done!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.