首页 技术 正文
技术 2022年11月20日
0 收藏 820 点赞 4,977 浏览 1646 个字
我在编译安装完Nginx、MySQL和PHP(见之前一篇博客:LNMP环境搭建详细教程)之后,进行apache的编译安装:
cd /usr/local/src 
wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.34.tar.gz 
tar zxvf httpd-2.4.34.tar.gz  
cd httpd-2.4.34  

./configure --prefix=/usr/local/httpd  
就在这个时候提示:configure: error: APR not found. Please read the documentation.
这说明缺少APR依赖,那么安装即可,可以用yum安装但是不推荐,因为yum安装的APR版本可能不足以支持你所安装的apache版本,所以还是要用编译安装高版本的APR:
cd /usr/local/src
wget http://archive.apache.org/dist/apr/apr-1.6.3.tar.gz 
wget http://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz

依次下载上述两个安装包并逐个解压缩:

tar zxvf apr-1.6.3.tar.gz
tar zxvf apr-util-1.6.1.tar.gz
cd/usr/local/src/apr-1.6.3 #安装apr./configure --prefix=/usr/local/apr  make && make install
cd /usr/local/src/apr-util-1.6.1  #安装apr-util./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr   make && make install
依赖全部安装完毕后再次切换到httpd的安装目录安装apache:
cd /usr/local/src/httpd-2.4.34./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-utilmake && make install

到此安装成功,想要启动、停止、重启apache需要用到命令:

/usr/local/httpd/bin/httpd -k start   ##开启
/usr/local/httpd/bin/httpd -k stop ##停止
/usr/local/httpd/bin/httpd -k restart ##重启

这里我在重启的时候就报了之前一篇博客:LNMP环境搭建详细教程中讲述的一个错误:

bind() to 0.0.0.0:80 failed (98: Address already in use)  这是因为我之前安装了nginx已经占用了80端口并且正在运行端口发生冲突,

所以就需要修改httpd的端口号,配置文件位置/usr/local/httpd/conf/httpd.conf:

vim /usr/local/httpd/conf/httpd.conf

搜索Listen 80将其改为Listen 8080(修改的端口号可以随便定义,范围是0~65535,其中0没有任何意义,也可以理解为1~65535),重启httpd提示新的错误:Could not reliably determine the server’s fully qualified domain name,

这是因为httpd.conf中ServerName未修改,搜索ServerName,将其改为:ServerName localhost:8080之后再次重启错误消失,查看一下正在运行的服务:

Linux下编译安装Apache报APR not found错误的解决办法

ps:上述安装的依赖版本并不是固定的,在安装的时候最好到官网看一下文档说明,选用高级的版本,比如用apr-1.3.*的版本,用来编译安装httpd-2.4.*的apache的时候就编译不了了

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,489
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,904
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,737
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,490
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,128
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,291