1. 基础环境准备
1.1 创建一个系统用户
[root@node2 ~]
1.2 所需工具安装:(wget、gcc、gcc-c++、make)
[root@node2 ~]
1.3 下载源码包
httpd包下载地址:
https://downloads.apache.org/httpd/httpd-2.4.54.tar.gz
apr包下载地址:
https://downloads.apache.org/apr/apr-1.7.0.tar.gz
apr-util包下载地址:
https://downloads.apache.org/apr/apr-util-1.6.1.tar.gz
[root@node2 src]
1.4 其他环境所需准备:openssl-devel、pcre-devel、expat-devel、libtool
[root@node2 ~] yum -y install openssl-devel pcre-devel expat-devel libtool
2. apr编译安装
修改apr的configure脚本文件:删除或者注释
cfgfile"这行
2.1 指定安装路径configure
[root@node2 apr-1.7.0]
2.2 检测通过后生产Makefile文件
[root@node2 apr-1.7.0]
2.3 执行make命令进行编译
[root@node2 apr-1.7.0]
2.4 执行make install命令
[root@node2 apr-1.7.0]
3. apr-util编译安装
3.1 指定安装路径configure
[root@node2 apr-util-1.6.1]
3.2 检测通过后生产Makefile文件
[root@node2 apr-util-1.6.1]
3.3 执行make命令进行编译
[root@node2 apr-util-1.6.1]
3.4 执行make install命令
[root@node2 apr-util-1.6.1]
4.httpd编译安装
4.1 指定安装路径configure
[root@node2 httpd-2.4.54]
4.2 检测通过后生产Makefile文件
[root@node2 httpd-2.4.54]
4.3 执行make命令进行编译
[root@node2 httpd-2.4.54]
4.4 执行make intall命令
[root@node2 httpd-2.4.54]
4.5 设置环境变量
[root@node2 local]
4.6 设置映射关系
[root@node2 ~]
4.7 设置man文档
[root@node2 ~]
5. 开启httpd服务
[root@node2 ~]
6. 关闭防火墙和selinux并查看端口号
[root@node2 ~]
7. 使用地址访问
8. 源码编译报错信息处理总结
xml/apr_xml.c:35:10: fatal error: expat.h: No such file or directory
#include <expat.h>
^
~
~
解决方案
[root@node2 apr-util-1.6.1]
configure: error: pcre(2)-config for libpcre not found. PCRE is required and available from
http://pcre.org/
解决方案
[root@node2 httpd-2.4.54]
checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but can not be built due to prerequisite failures
解决方案
[root@node2 httpd-2.4.54]
collect2: error: ld returned 1 exit status
解决方案
[root@node2 ~]