83

这是我第一次尝试以普通用户(非 root)的身份在本地安装 Apache HTTP 服务器。

我已经下载了 Apache HTTP 服务器 [http://httpd.apache.org/download.cgi] 的 Apache 2.4.1 版本。但是,当我尝试在我的盒子中本地构建和安装时,出现以下错误:

httpd/httpd-2.4.1 1059> ./configure
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu

Configuring Apache Portable Runtime library ...

checking for APR... no
configure: error: APR not found.  Please read the documentation.

我不确定它在寻找什么依赖 - 我的意思是下载包不包含它?我需要做什么来构建/部署 Apache HTTP 服务器?

提前致谢。

4

9 回答 9

132

当它告诉您时Please read documentation,这意味着您应该去阅读 Apache 文档(http://httpd.apache.org/docs/2.4/install.html),它告诉您

从Apache APR下载 APR 和 APR-Util 的最新版本,将它们解压缩到 ./srclib/apr 和 ./srclib/apr-util (确保域名没有版本号;例如,APR 分发必须在 ./srclib/apr/ 下)

然后做

./configure --with-included-apr
于 2012-02-24T19:40:01.030 回答
40

对于 Ubuntu 11.10,此选项似乎运行良好:

 # APR

wget http://mirrors.axint.net/apache//apr/apr-1.4.6.tar.gz

tar -xvzf apr-1.4.6.tar.gz

cd apr-1.4.6/

./configure

make

make install

cd ..

# APR Utils

wget http://mirrors.axint.net/apache//apr/apr-util-1.4.1.tar.gz

tar -xvzf apr-util-1.4.1.tar.gz

cd apr-util-1.4.1

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

make

make install

cd ..

# Apache

wget http://apache.petsads.us//httpd/httpd-2.4.1.tar.gz

tar -xvzf httpd-2.4.1.tar.gz

cd httpd-2.4.1

./configure --enable-file-cache --enable-cache --enable-disk-cache --enable-mem-cache --enable-deflate --enable-expires --enable-headers --enable-usertrack --enable-ssl --enable-cgi --enable-vhost-alias --enable-rewrite --enable-so --with-apr=/usr/local/apr/

make

make install

cd ..

您可以在下面找到有关它的更多信息

资料来源:VaporCreations.com

于 2012-04-07T20:10:21.197 回答
27

如果你有 Debian/Ubuntu,你可以:

apt-get install libapr1-dev libaprutil1-dev

然后./configure

完毕

于 2013-01-22T18:39:58.540 回答
20

以下是我如何在非 root 用户上安装 apache-httpd 的步骤:

  1. 下载并解压apache-httpd-2.4.2(但在./configuring、制作和安装之前,请按照以下步骤操作:)
  2. 下载并解压 APR 和 APR-UTIL 到“./srclib/apr”和“./srclib/apr-util”文件夹。这需要 ./configure --with-apr=./apache/httpd-2.4.2/srclib/apr (和) --with-included-apr (选项)。
  3. 下载、解压、./configure (with) --prefix=localURL、make 并将 PCRE 安装到“./pcre”文件夹中。这需要 ./configure --with-pcre=/home/username/apache/pcre (选项)。
  4. 通过输入以下命令来配置 apache-httpd(我喜欢启用以下命令中所写的某些选项): ./configure --enable-file-cache --enable-cache --enable-disk-cache --enable-mem -cache --enable-deflate --enable-expires --enable-headers --enable-usertrack --enable-cgi --enable-vhost-alias --enable-rewrite --enable-so --with-apr= /home/username/apache/httpd-2.4.2/srclib/apr --prefix=/home/username/apache/httpd-2.4.2/ --with-included-apr --with-pcre=/home/username /apache/pcre 注意:配置 apache-httpd 时,仅当安装了 OpenSSL 时才使用选项“--enable-ssl”,否则不要启用它。
  5. 现在在命令行上,输入“make”和“make install”命令。
  6. 打开并配置“httpd.conf”文件,例如:“vi /home/eddie_kumar/apache/httpd-2.4.2/conf/httpd.conf”

重要提示:不要忘记将默认端口从 80 更改为其他值,例如 8080,这对于非 root 用户尤其重要。(如何?打开 httpd.conf -> 搜索“Listen 80” -> 将其更改为“Listen 8080”。

就是这样,现在打开浏览器输入“localhost: 8080 ”,它应该显示“It works!”。

于 2012-05-03T13:14:08.147 回答
3

如果你使用 fedora,你可以使用yum来安装APR、APR-Util 和 PCRE。您还需要下载 apr-devel、apr-util-devel 和 pcre-devel。

话虽如此,您只需在终端上运行以下命令,就不会再出现“ configure: error: APR not found.. ..APR-Util and PCRE ”错误。

yum -y install arp apr-devel apr-util apr-util-devel pcre pcre-devel 

我正在使用 Fedora 17 并计划使用 shell 脚本来设置 apache 2.4.3。所以yum工作起来相当流畅,而不是手动下载 apr、apr-util 和 pcre。

于 2013-01-23T04:56:43.673 回答
1

1、你需要APR(apache便携式运行时),它是apache web server的核心组件

2、如果你想进行make install,你可能需要root账号

3,即使没有,apache也无法在没有root帐户的情况下开始监听非特权端口(低于1024)

4,获得root权限或让具有root权限的人从官方仓库安装apache(我不知道你运行的是哪个发行版),比如使用yum、apt-get等...

于 2012-02-24T19:41:22.160 回答
0

Apr 或 pcre 相关错误需要下载源代码,并且需要让 Apache HTTPD“配置”过程了解文件系统上的这些源代码位置。例如:如果您在 ./srclib(相对于 apache httpd)下载了 APR 的源代码,那么您将使用
--with-included-apr
作为配置选项。

另一方面,如果您不想构建而是安装 APR / APR-UTIL,那么您需要在 CentOS / RedHat 上进行以下操作:
yum install apr-util-devel apr-devel
但是可能会发生 yum 提供的 APR 版本与此版本的 Apache httpd 所期望的不匹配。在这种情况下,您可以下载 APR 和 APR-UTIL 并使用 --with-included-apr 选项。

您还可以使用相同的“配置、制作、安装”过程构建 PCRE,然后从您停止构建 Apache httpd 的地方继续。
或者你可以安装 pcre: yum install pcre-devel

如果在构建 PCRE 时:您看到“编译:无法识别的选项”,那么您可能还需要其他依赖项:请参阅以下详细信息:http:
//khanna111.com/wordPressBlog/2012/09/11/94087-2/
还涵盖“mod_deflate”和“zlib”。

于 2014-10-22T19:45:28.203 回答
0

基本步骤

tar -xvf httpd-2.4.1-customized.tar -C ../
#Balancer folder will be created
tar -xvzf openssl-1.0.1.tar.gz  -C /balancer/
cd ->/balancer/openssl-1.0.1
./config --prefix=/usr/local/ssl/ shared zlib-dynamic enable-camellia
make depend
make
make install
tar -xvzf pcre-8.30.tar.gz -C ../balancer/

/balancer/pcre-8.30
./configure  --prefix=/usr/local/pcre/
make
make install

删除 pcre 和 openssl

于 2015-09-12T21:09:31.647 回答
0

在 Ubuntu 机器上安装和编译 Apache 服务器

第一步:安装Java JDK

sudo apt install openjdk-11-jdk

sudo gedit /etc/environment

JAVA_HOME="/usr/lib/jvm/openjdk-11"

source /etc/environment

echo $JAVA_HOME

验证java版本

javac --version

****安装其他需要的包:**

  sudo apt-get install apache2-dev -y 

sudo apt-get install libpcre3 libpcre3-dev

第 2 步:安装 Apache HTTP 服务器

#1 对于 ubuntu,安装开发工具,包括 C 编译器:

sudo apt-get install build-essential checkinstall

#2 下载并解压所需文件

假设所有文件都已下载到 ~/Downloads 目录

从 Apache 下载页面 ( https://httpd.apache.org/download.cgi )下载 Apache HTTP Server httpd-2.4.41.tar.gz

并遵循编译 apache HTTP 服务器所需的库:

****阅读要求部分(http://httpd.apache.org/docs/2.4/install.html)***

#3 解压 tar 文件

  • tar -xvf httpd-2.4.41.tar.gz
  • tar -xvf apr-1.7.0.tar.gz
  • tar -xvf apr-util-1.6.1.tar.gz
  • tar -xvf pcre2-10.34.tar.gz

提取后,您应该在 ~/Downloads 中看到以下目录列表

  • httpd-2.4.41
  • 4月-1.7.0
  • apr-util-1.6.1
  • pcre2-10.34

#4 为 apache HTTP 服务器创建一个目录

*确保授予此目录的所有权限,以便在编译文件时可以读取/写入

 sudo mkdir /home{your username here}/apache

授予 apache 目录的所有权限:

sudo chmod -R 777 /home{your username here}/apache

#5 将arp和arp-util目录复制到~/Downloads/httpd-2.4.41/srclib/

cd ~/Downloads

mv  apr-util-1.6.1  ~/Downloads/httpd-2.4.41/srclib/apr-util

 mv  apr-1.7.0  ~/Downloads/httpd-2.4.41/srclib/apr

#6 配置编译源。 --prefix 选项可用于将 Web 服务器安装在可以写入文件的位置。

cd ~/Downloads/httpd-2.4.41/


./configure  --prefix=/home/{username here}/apache --with-pcre=~/Downloads/pcre2-10.34

注意: 如果您在运行上述命令时遇到问题,您也可以尝试

在 /usr/local/pcre 中安装 pcre,使用

./configure --prefix=/usr/local/pcre make sudo make install

命令,然后通过运行以下命令:

   cd ~/Downloads/httpd-2.4.41/

./configure --prefix=/home/{username here}/apache --with-pcre=/usr/local/pcre

制作

  sudo make install

如果您仍然遇到一些问题,请确保 ~/apache 及其嵌套目录具有读/写权限。如果不 **sudo chmod -R 777 /home{your username here}/apache**再次运行命令。

#7 编译 Apache HTTP 服务器。

cd ~/Downloads/httpd-2.2.25

sudo make

#8 安装 Apache HTTP 服务器。

cd ~/Downloads/httpd-2.2.25

sudo make install

可选 #9 准备您的主机文件

sudo gedit /etc/hosts

27.0.0.1 本地主机 www.example.com

sudo gedit /home/{your username here}/apache/conf/httpd.conf

并复制:

Listen 8000

ServerName www.example.com:8000

#10 测试安装以确保 Apache HTTP Server 正常工作。

/home/{your username here}//apache/bin/apachectl -k start
于 2020-03-03T17:53:58.360 回答