源码包安装
约定:源码包放在 cd/use/local/src
我先把httpd源码包下载到cd/use/local/src 如下所示
下载源码包
#cd/usr/local/src/
[root@localhost src]# wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz 下载源包
[root@localhost src]# wget http://mirrors.cnnic.cn/aparche/httpd-2.2.32.tar.gz
-bash: wget: 未找到命令 说明没有安装wget 命令,执行#yum intall -y wget
2018-01-10 13:54:04 错误 404:Not Found。出现这种情况说明下载链接是错误的,需要更新链接
#echo $? 结果是0 表示上一步正确,1表示上一步错误
下载完之后查看文件的类型
[root@localhost src]# ls
apr-util-1.6.1.tar.gz 说明是一个tar .gz的压缩包
解压压缩包
[root@localhost src]# tar -zxvf apr-util-1.6.1.tar.gz 解压源码包
apr-util-1.6.1/
apr-util-1.6.1/strmatch/
apr-util-1.6.1/strmatch/apr_strmatch.c
apr-util-1.6.1/uri/
apr-util-1.6.1/uri/apr_uri.c
apr-util-1.6.1/apr-util.spec
apr-util-1.6.1/README.FREETDS
....
....
配置相关选项——指定安装路径
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apache2 指定安装路径
出现如下错误
checking for gcc... no 说明没有安装gcc
checking for cc... no
checking for cl.exe... no
安装gcc
#yum install -y gcc
重新执行配置选项
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apache2
安装gcc之后还出现如下报错
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apache2
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
APR-util Version: 1.6.1
checking for chosen layout... apr-util
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
Applying apr-util hints file rules for x86_64-pc-linux-gnu
checking for APR... no
configure: error: APR could not be located. Please use the --with-apr option.
提示:configure: error: APR could not be located. Please use the --with-apr option. 说明需要指定--with-apr参数
指定参数编译
#./configure --with-apr=/usr/local/apr
编译完后结果还报错结果如下:
[root@localhost apr-util-1.6.1]# ./configure --with-apr=/usr/local/apr
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
APR-util Version: 1.6.1
checking for chosen layout... apr-util
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
Applying apr-util hints file rules for x86_64-pc-linux-gnu
checking for APR... configure: error: the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.
[root@localhost apr-util-1.6.1]# echo $?
1
错误提示checking for APR... configure: error: the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file. 说明:配置错误:with-apr参数不正确,它必须指定一个安装前缀,一个构建目录或是一个配置apr文件。
本文转自 yzllinux 51CTO博客,原文链接:http://blog.51cto.com/12947851/2059262,如需转载请自行联系原作者