当前位置: 首页 > 工具软件 > And-httpd > 使用案例 >

linux下安装Apache-httpd-2.4

越开畅
2023-12-01

1.安装httpd

从http://httpd.apache.org/下载:httpd-2.4.10.tar.gz

tar zxvf httpd-2.4.10.tar.gz
cd xx/httpd-2.4.10
./configure --prefix=/home/soft/httpd-2.4.10
检查编辑环境时出现:
checking for APR... no
configure: error: APR not found . Please read the documentation. 用 ./configure –help | grep apr 查看帮助
--with-included-apr Use bundled copies of APR/APR-Util
--with-apr=PATH prefix for installed APR or the full path to apr-config
--with-apr-util=PATH prefix for installed APU or the full path to

2.安装apr

从http://apr.apache.org/download.cgi下载:apr-1.5.1.tar.gz

tar zxvf apr-1.5.1.tar.gz

cd xx/apr-1.5.1

./configure --prefix=/home/soft/apr-1.5.1

make
make install
可选:
make clean
make distclean
cd ..
rm -rf apr-1.5.1


3.再次安装httpd

./configure --prefix=/home/soft/httpd-2.4.10 --with-apr=/home/soft/apr-1.5.1

再次检查编译环境出现
checking for APR-util... no
configure: error: APR-util not found . Please read the documentation.

./configure –help | grep apr-util 查看帮助

--with-apr-util=PATH prefix for installed APU or the full path to


4.安装apr-util

从http://apr.apache.org/download.cgi下载:apr-util-1.5.4.tar.gz

tar zxvf apr-util-1.5.4.tar.gz

cd xx/apr-util-1.5.4

./configure --prefix=/home/soft/apr-util-1.5.4 --with-apr=/home/soft/apr-1.5.1  (apr-util依赖apr)

make
make install
可选:
make clean
make distclean
cd ..
rm -rf apr-util-1.5.4


5.再次安装httpd

./configure --prefix=/home/soft/httpd-2.4.10 --with-apr=/home/soft/apr-1.5.1  --with-apr-util=/home/soft/apr-util-1.5.4

再次检查编译环境出现

configure: error: pcre-config for libpcre not found. PCRE is required and available fromhttp://pcre.org/

./configure –help | grep pcre 查看帮助

--with-pcre=PATH Use external PCRE library 


6.安装pcre

从http://pcre.org/下载:pcre-8.36.tar.gz

tar zxvf pcre-8.36.tar.gz

cd xx/pcre-8.36

./configure --prefix=/home/soft/pcre-8.36

make
make install
可选:
make clean
make distclean
cd ..
rm -rf pcre-8.36

  注意:pcre安装过程出现了错误,提示需要安装:yum install gcc-c++


7.再次安装httpd
./configure --prefix=/home/soft/httpd-2.4.10 --with-apr=/home/soft/apr-1.5.1  --with-apr-util=/home/soft/apr-util-1.5.4 --with-pcre=/home/soft/pcre-8.36

终于没有编译错误了,继续...

make
make install
可选:
make clean
make distclean
cd ..
rm -rf httpd-2.4.10


试用一下:

查看80端口是否被占用
[root@localhost conf]#netstat -an | grep :80 
端口可能被占用,修改conf/httpd.conf 将 Listen 80 改为 Listen 7777

[root@localhost bin]# apachectl start
访问:http://localhost:7777/  出现:

It works!

表示安装并启动成功。
停止:[root@localhost bin]# apachectl stop

一路艰辛,都是通过网络搜索答案,其实apache官方是有明确依赖说明的:http://httpd.apache.org/docs/2.4/en/install.html,搜索"Requirements"可以看到。

 类似资料: