使用源码在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的更多相关文章

  1. CentOS下安装Apache

    CentOS下安装Apache,首先在用户状态下使用su root命令切换到超级管理员界面,让后开启终端,进行apache的安装过程. [root@localhost centos]# yum ins ...

  2. CentOS 7 安装 Apache PHP MariaDB

    准备篇: 一.配置防火墙,开启80端口.3306端口 CentOS 7 默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl sto ...

  3. CentOS yum安装Apache + PHP + Tomcat7 + MySQL

    Linux平台上用得最多的web环境就是php.java和MySQL了,会搭建这个环境,就能把很多开源程序跑起来. 作为一个程序猿,虽然并不用精通运维的活,但基本的Linux环境搭建还是要掌握比较好, ...

  4. CentOS yum 安装 Apache + PHP + MySQL

    # 检查并卸载rpm -qa|grep httpdrpm -e httpdrpm -qa|grep mysqlrpm -e mysqlrpm -qa|grep phprpm -e php # 删除默认 ...

  5. linux centos 7安装 apache php 及mariadb

    1安装Apache, PHP, MySQL以及php库组件. yum -y install httpd php mysql  php-mysql 2 安装apache扩展 yum -y install ...

  6. [转] CentOS单独安装Apache Benchmark压力测试工具的办法

    Apache安装包中自带的压力测试工具 Apache Benchmark(简称ab) 简单易用,这里就采用 ab作为压力测试工具了. 1.独立安装 ab运行需要依赖apr-util包,安装命令为: 1 ...

  7. centos编译安装apache

    1.安装工具和依赖包 yum install unzipyum -y install pcre-develyum groupinstall "Development Tools" ...

  8. 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版本,安装方法一样, ...

  9. centos 编译安装Apache 2.4

    2013年12月29日 16:40:20 ./configure --prefix=/usr/local/web/apache --enable-so --enable-rewrite --enabl ...

随机推荐

  1. POJ 1515 Street Directions (边双连通)

    <题目链接> 题目大意: 有m条无向边,现在把一些边改成有向边,使得所有的点还可以互相到达.输出改变后的图的所有边(无向边当成双向的有向边输出). 解题分析: 因为修改边后,所有点仍然需要 ...

  2. 转载:使用Tornado+Redis维护ADSL拨号服务器代理池

    我们尝试维护过一个免费的代理池,但是代理池效果用过就知道了,毕竟里面有大量免费代理,虽然这些代理是可用的,但是既然我们能刷到这个免费代理,别人也能呀,所以就导致这个代理同时被很多人使用来抓取网站,所以 ...

  3. 微信小程序做radio,可以拖动进度条

    很简单的一个音乐播放器 data:{ src: 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4a ...

  4. DWM1000 收发RXLED TXLED控制代码修改

    DWM1000 模块一共可以最多外接4个LED,但是API默认只会只用到两个LED,分别是RXLED.TX LED. 特别注意:RXLED 是模块在RX 状态,而不是接收到数据. 修改代码,使得4个L ...

  5. 10树莓派Samba的安装与配置

    2017-08-31 12:28:26 1.安装samba服务打开终端或者SSH连接树莓派,输入如下命令: sudo apt-get install samba 已经安装过了显示下列信息: pi@ra ...

  6. JTS相关资料和示例

    示例 JTS基本概念和使用 JTS Geometry之间的关系 JTS algorithm package

  7. 201771010126.王燕《面向对象程序设计(Java)》第六周学习总结

    实验六 继承定义与使用 实验时间 2018-9-28 1.实验目的与要求 (1) 理解继承的定义: 继承就是用已有类来构建新类的一种机制,当你继承了一个类时,就继承了这个类的方法和字段,同时你也可以在 ...

  8. CSS3 三次贝塞尔曲线(cubic-bezier)

    例子:transition:all 1s cubic-bezier(.21,.2,.65,.1) 最近在看animation模块,其中animation-timing-function 和 trans ...

  9. __x__(10)0906第三天__字符实体(转义字符)

    实体:也叫转义字符,在网页中,一些类似“大于号”和“小于号”这样的字符,无法直接使用,需要用特殊的字符串来表示. 实体语法: “&实体名字;” 或者 “&实体编号;” 注意: 最好使用 ...

  10. [LeetCode] Rotated Digits 旋转数字

    X is a good number if after rotating each digit individually by 180 degrees, we get a valid number t ...