CentOS 7 安装Apache 2.4.39
使用源码在CentOS 7下安装 apache 2.4.39,之前趟了一遍,简单做个笔记。
STEP 1 安装apr
STEP 1.1 检查是否安装apr
[root@study ~]# yum list apr
# 如果没有安装, 则进入STEP 1.2;
# 查看apr的位置
[root@study ~]# whereis apr
apr: /usr/local/apr
STEP 1.2 安装apr
[root@study ~]# cd source
[root@study source]# wget http://DOWNLOAD/apr-1.7.0.tar.gz
# DOWNLOAD 替换相应的镜像
[root@study source]# tar -xzvf apr-1.7..tar.gz
[root@study source]# cd apr-1.7.
[root@study apr-1.7.]# ./configure --prefix=/usr/local/apr
[root@study apr-1.7.]# make && make install
STEP 2 安装libxml2
由于apahce 依赖的apr-util.1.6.1依赖libxml2库,如果没有安装libxml2库,则在apache的配置中会有如下错误产生:
usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_GetErrorCode'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetEntityDeclHandler'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ParserCreate'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetCharacterDataHandler'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ParserFree'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetUserData'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_StopParser'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_Parse'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ErrorString'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetElementHandler'
collect2: error: ld returned 1 exit status
make[2]: *** [htpasswd] 错误 1
make[2]: 离开目录“/opt/source/apache.httpd/httpd-2.4.39/support”
make[1]: *** [all-recursive] 错误 1
make[1]: 离开目录“/opt/source/apache.httpd/httpd-2.4.39/support”
make: *** [all-recursive] 错误 1
STEP 2.1 检查是否安装 libxml2
[root@study ~]# yum list libxml2
# 如果没有安装则,进行libxml2安装
[root@study ~]# yum install libxml2-devel
STEP 3 安装expat
如果没有安装expat,可能在安装apr-util中会报如下错误:
xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录
#include <expat.h>
STEP 3.1 检查是否安装expat
[root@study ~]# yum list expat
# 如果没有安装则进行安装
[root@study ~]# yum install expat-devel
STEP 4 安装apr-util
STEP 4.1 检查是否安装apr-util
[root@study ~]# yum list apr-util
# 如果没有安装则进入 STEP 4.2 进行安装
[root@study ~]# whereis apr-util
apr-util: /usr/local/apr-util
STEP 4.2 安装apr-util
[root@study ~]# cd source
[root@study source]# wget http://DOWNLOAD/apr-util-1.6.1.tar.gz
[root@study source]# tar -xzvf apr-util-1.6..tar.gz
[root@study source]# cd apr-util.1.6.
[root@study apr-util.1.6.]# ./configure --prefix=/usr/local/apr-util
[root@study aapr-util.1.6.]# make && make install
STEP 5 安装pcre
STEP 5.1 检查是否安装pcre
[root@study ~]# yum list pcre
# 如果没有安装,则进入 STEP 5.2 进行安装
[root@study ~]# whereis pcre
pcre: /usr/include/pcre.h /usr/local/pcre /usr/share/man/man3/pcre..gz
STEP 5.2 安装pcre
[root@study ~]# cd source
[root@study ~]# url=https://jaist.dl.sourceforge.net/project/pcre/pcre/8.43/pcre-8.43.tar.gz
[root@study source]# wget ${url}
[root@study source]# tar -xzvf pcre-8.43.tar.gz
[root@study source]# cd pcre-8.43
[root@study pcre-8.43]# ./configure --prefix=/usr/local/pcre
[root@study pcre-8.43]# make && make install
STEP 6 安装apache
[root@study source]# tar -xzvf http-2.4..tar.gz
[root@study source]# cd httpd-2.4.
[root@study httpd-2.4.]# ./configure --prefix=/usr/local/apache24 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
[root@study httpd-2.4.]# make && make install
STEP 7 设置service文件
[root@study ~]# cd /usr/lib/systemd/system
[root@study system]# vim httpd.service [Unit]
Description=Apache 2.4.
After=network.target
After=syslog.target
[Service]
Type=forking
ExecStart=/usr/local/apache24/bin/apachectl -k start
ExecStop=/usr/local/apache24/bin/apachectl -k stop
ExecReload=/usr/local/apache24/bin/apachectl -k restart
[Install]
WantedBy=multi-user.target
Alias=http.service
STEP 8 设置防火墙以及开机启动
# 允许开放http服务
[root@study ~]# firewall-cmd --permanent --add-service=http
# 打开http服务的80 tcp端口
[root@study ~]# firewall-cmd --permanent --add-port=/tcp
# 重新加载防火墙规则
[root@study ~]# firewall-cmd --reload
# 重新启动apach
[root@study ~]# systemctl restart httpd.service
# 设置开机启动
[root@study ~]# systemctl enable httpd.service
CentOS 7 安装Apache 2.4.39的更多相关文章
- CentOS下安装Apache
CentOS下安装Apache,首先在用户状态下使用su root命令切换到超级管理员界面,让后开启终端,进行apache的安装过程. [root@localhost centos]# yum ins ...
- CentOS 7 安装 Apache PHP MariaDB
准备篇: 一.配置防火墙,开启80端口.3306端口 CentOS 7 默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl sto ...
- CentOS yum安装Apache + PHP + Tomcat7 + MySQL
Linux平台上用得最多的web环境就是php.java和MySQL了,会搭建这个环境,就能把很多开源程序跑起来. 作为一个程序猿,虽然并不用精通运维的活,但基本的Linux环境搭建还是要掌握比较好, ...
- CentOS yum 安装 Apache + PHP + MySQL
# 检查并卸载rpm -qa|grep httpdrpm -e httpdrpm -qa|grep mysqlrpm -e mysqlrpm -qa|grep phprpm -e php # 删除默认 ...
- linux centos 7安装 apache php 及mariadb
1安装Apache, PHP, MySQL以及php库组件. yum -y install httpd php mysql php-mysql 2 安装apache扩展 yum -y install ...
- [转] CentOS单独安装Apache Benchmark压力测试工具的办法
Apache安装包中自带的压力测试工具 Apache Benchmark(简称ab) 简单易用,这里就采用 ab作为压力测试工具了. 1.独立安装 ab运行需要依赖apr-util包,安装命令为: 1 ...
- centos编译安装apache
1.安装工具和依赖包 yum install unzipyum -y install pcre-develyum groupinstall "Development Tools" ...
- CentOS编译安装Apache 2.4.x时报错:configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.
先前按照这篇文章“CentOS6.x编译安装LAMP(2):编译安装 Apache2.2.22”去编译安装Apache2.2.x版本时,安装得挺顺利,今天换成Apache2.4.x版本,安装方法一样, ...
- centos 编译安装Apache 2.4
2013年12月29日 16:40:20 ./configure --prefix=/usr/local/web/apache --enable-so --enable-rewrite --enabl ...
随机推荐
- 设置通过Maven创建工程的JDK版本
在eclipse中创建的Maven工程默认的运行环境为JDK1.5,如果想修改JDK的版本,无非是右键项目点击Build Path->Configure Build Path修改JDK信息-&g ...
- flask微电影系统开发中上下文处理器
在做日志模块开发的过程中,我们遇到了一个问题,就是日期的问题,我们这个时间就要用到上下文处理器来解决问题,他的作用就是可以在我们固定模块中进行传递,我们的模块如下 @admin.context_pro ...
- kvm认识和安装
虚拟化定义: 是指通过虚拟化技术将一台计算机虚拟为多台逻辑计算机.在一台计算机上同时运行多个逻辑计算机,每个逻辑计算机可运行不同的操作系统,并且应用程序都可以在相互独立的空间内运行而互不影响,从而显著 ...
- css 制作翻页布局
代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8 ...
- GMA Round 1 离心率
传送门 离心率 P是椭圆$\frac{x^2}{a^2}+\frac{y^2}{b^2}=1$上一点,F1.F2为椭圆左右焦点.△PF1F2内心为M,直线PM与x轴相交于点N,NF1:NF2=4:3. ...
- (79)Wangdao.com第十五天_JavaScript 对象的继承_prototype原型对象_封装_函数式编程
javascript 内置了许多 function 函数(){...} js 执行首先就会执行自己内置的函数定义 (function Function.function Object) 对象的继承 大 ...
- [LeetCode] Random Pick with Blacklist 带黑名单的随机选取
Given a blacklist B containing unique integers from [0, N), write a function to return a uniform ran ...
- 简单的SQL查询,循环插入
- Python基础之集合
一.定义: 二.基本操作: 三.运算: 交集&, 并集|, 补集-, 对称补集^, 子集< 超集> 四.集合推导式: 五.固定集合 frozenset 六.基本代码: # 1. ...
- Thymeleaf常用th标签
https://www.jianshu.com/p/f9ebd23e8da4 关键字 功能介绍 案例 th:id 替换id <input th:id="'xxx' + ${collec ...