Red Hat Enterprise Linux 7 安装 Apache服务 httpd2.4.41.tar.gz 遇到的问题及解决方法

–>

一.安装Apache遇到问题

Red Hat Enterprise Linux 7 64 位
httpd-2.4.41.tar.gz 下载地址http://httpd.apache.org/download.cgi#apache24
开始安装
cd /usr/local
mkdir work //将httpd-2.4.41.tar.gz 复制到此路径下
cd work
tar xfz httpd-2.4.41.tar.gz
cd httpd-2.4.41
./configure -prefix=/usr/local/Apache2 -enable-module=so

遇到错误
[[email protected] httpd-2.4.41]# ./configure -prefix=/usr/local/Apache2 -enable-module=so
checking for chosen layout… Apache
checking for working mkdir -p… yes
checking for grep that handles long lines and -e… /usr/bin/grep
checking for egrep… /usr/bin/grep -E
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
configure:
configure: Configuring Apache Portable Runtime library…
configure:
checking for APR… no
configure: error: APR not found. Please read the documentation.

[[email protected] httpd-2.4.41]# make
make: *** 没有指明目标并且找不到 makefile。 停止。
当时百度了网友们的方法 差不多大概有两种

就是安装gcc-c++openssl了

yum install gcc-c++ -y
yum install openssl* -y
注意 用yum安装时要配置好yum源(只要不是小白,大家都知道)

这两种方法对于我的环境不管用

二.解决问题

[[email protected] httpd-2.4.41]# ./configure -prefix=/usr/local/Apache2 -enable-module=so
checking for chosen layout… Apache
checking for working mkdir -p… yes
checking for grep that handles long lines and -e… /usr/bin/grep
checking for egrep… /usr/bin/grep -E
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
configure:
configure: Configuring Apache Portable Runtime library…
configure:
checking for APR… no
configure: error: APR not found. Please read the documentation.

1.下载所需软件包:

wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip

2.编译安装:

具体步骤如下:

1:解决apr not found

[[email protected] test]# tar -zxf apr-1.4.5.tar.gz
[[email protected] test]# cd apr-1.4.5
[[email protected] apr-1.4.5]# ./configure –prefix=/usr/local/apr
[[email protected] apr-1.4.5]# make && make install

b:解决APR-util not found

[[email protected] test]# tar -zxf apr-util-1.3.12.tar.gz
[[email protected] test]# cd apr-util-1.3.12
[[email protected] apr-util-1.3.12]# ./configure –prefix=/usr/local/apr-util -with- apr=/usr/local/apr/bin/apr-1-config
[[email protected] apr-util-1.3.12]# make && make install

c:解决pcre

[[email protected] test]#unzip -o pcre-8.10.zip
[[email protected] test]#cd pcre-8.10
[[email protected] pcre-8.10]#./configure –prefix=/usr/local/pcre
[[email protected] pcre-8.10]#make && make install

d.最后编译Apache时加上:

–with-apr=/usr/local/apr
–with-apr-util=/usr/local/apr-util/
–with-pcre=/usr/local/pcre
根据自己情况三个选择添加,小编只添加前两个选项就OK
也就是
./configure -prefix=/usr/local/Apache2 -enable-module=so –with-apr=/usr/local/apr \ –with-apr-util=/usr/local/apr-util/
两个选项相连要有“\”
将Apache服务安装在指定目录/usr/local/Apache2

三.建立好makefile之后 的问题

编译文件

make

开始安装

make install

将Apache服务器添加到系统启动项中

[[email protected] bin]# /usr/local/Apache2/bin/apachectl start>>/etc/rc.d/rc.local
AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using localhost.localdomain. Set the ‘ServerName’ directive globally to suppress this message
新问题解决方法
cd /usr/local/Apache2/conf
vim http.conf

在vim编译器下搜索SeverName
/SeverName

黑色部分是自己添加的
退出来
:wq
重启一下服务
/usr/local/Apache2/bin/apachectl restart
再将Apache服务器添加到系统启动项中
/usr/local/Apache2/bin/apachectl start>>/etc/rc.d/rc.local
再重启一下子
/usr/local/Apache2/bin/apachectl restart

看一下是否安装成功

firefox localhost

出现 It works! 表示安装成功

小编水平有限,如有什么错误的地方,欢迎指出来。
本文借鉴
https://www.cnblogs.com/natty/p/10431269.html
https://www.cnblogs.com/visec479/p/5160297.html
https://blog.csdn.net/zhaomininternational/article/details/42293511

本文来源 互联网收集,文章内容系作者个人观点,不代表 本站 对观点赞同或支持。如需转载,请注明文章来源,如您发现有涉嫌抄袭侵权的内容,请联系本站核实处理。

© 版权声明

相关文章