使用源码在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. node环境配置

    1.进入node的官网https://nodejs.org/en/download/ 2.选择自己需要的安装包 3.下载之后,直接安装http://www.runoob.com/nodejs/node ...

  2. phantomjs 中文文档

    phantomjs 中文文档 转载 入门教程:转载 http://www.cnblogs.com/front-Thinking/p/4321720.html 1.介绍 简介   PhantomJS是一 ...

  3. GMA Round 1 三角形

    传送门 三角形 在△ABC中已知$sin2A+sin2B+sin2C=\frac{3\sqrt{3}}{2}$,求$cos\frac{A}{2}*cos\frac{B}{2}*cos\frac{C}{ ...

  4. linux中安装和配置 jdk

    01.去官网下载指定的jdk 02.使用xftp把下载好的文件 传递到 linux指定文件夹中03.进入指定的文件夹输入tar -zxvf 文件名称04.发现文件 05.进入文件cd jdk1.8.0 ...

  5. readonly与disabled的区别

    一. 范围不同 readonly 只对 <input> 和 <textarea> 标签有效 disabled 对所有表单元素都有效, 包括:<input>, < ...

  6. Django中web开发用md5加密图片名并存储静态文件夹

    一般在开发中,有的网站存在大量图片,首先图片的名称是不能重复的, 但是除了数据库可用的id以外我们可以用time模块中time.time()获取的时间来进行md5加密操作, 因为time模块所产生的时 ...

  7. Django数据库,在原有表中添加新字段

    1.在你要添加新字段的app的 models.py 文件中添加需要新增的字段(这里新增的是dress字段): from django.db import models # Create your mo ...

  8. 爱奇艺直播 - 春晚直播业务API架构

    小结: 1.服务熔断策略 在网关服务中经常会对后端不同api接口做服务聚合,比如A服务 -> B服务 -> C服务 ,如果C服务出现问题,那么在调用C服务之前需要做熔断.而在设计熔断器的时 ...

  9. react-native-Cocoapods-Swift-Project

    https://reactnative.cn/docs/integration-with-existing-apps/ 1.创建一个xcode工程,single View就行,项目语言选择swift, ...

  10. SM3杂凑算法Python语言实现——第三部分

    SM3杂凑算法实现--第三部分 一.SM3 密码概述        我们首先把需要用到的算法呈现出来,最后我们再考虑如何集合为一个库的方法,这一部分我们就开始编写一个新的算法:国家商用密码标准SM3密 ...