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 ...
随机推荐
- 分布式文档存储数据库 MongoDB
MongoDB 详细介绍 MongoDB是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的.他支持的数据结构非常松散,是类似json的bjson格式,因此可以 ...
- [Web]Restful风格的适用场景
最近一直在兜兜转转Restful的相关内容,准备在原先的项目上构建restful的API. 实践过程很别扭,直到看到这篇文章[A Brief Introduction to REST], 我才终于断定 ...
- 网易im即时通讯 移动端嵌入web
近期产品需求要在wapapp 内部嵌入网易im聊天客服功能,内部需求不是很多,不过还是第一次接触,有点抓耳,,, 希望召集更多大神交流878269930 增加用户默认发送自定义消息功能:
- Vue使用vue-echarts图表
vue-echarts和echarts的区别: vue-echarts是封装后的vue插件, 基于 ECharts v4.0.1+ 开发,依赖 Vue.js v2.2.6+,功能一样的只是把它封装成v ...
- FastDFS 分布式文件系统的安装与使用(单节点)
FastDFS 分布式文件系统的安装与使用(单节点) 跟踪服务器:192.168.4.121 (edu-dfs-tracker-01) 存储服务器:192.168.4.125 (edu-dfs-sto ...
- Java读取文本文件中文乱码问题
最近遇到一个问题,Java读取文本文件(例如csv文件.txt文件等),遇到中文就变成乱码.读取代码如下: List<String> lines=new ArrayList<Stri ...
- linux下安装前端程序员必备软件
startx进入桌面后,ctrl+alt+t调出终端.安装完成以后重启在软件ubuntu软件中找到软件启动或通过终端输入命令找到,锁定到启动器. 1.首先安装chrome(64位) cd /tm ...
- Selenium 3----获取断言信息
断言:把实际结果与预期进行比较. 一般可以通过获取title .URL和text等信息进行断言. title:用于获得当前页面的标题. current_url:用户获得当前页面的URL. text:获 ...
- asch相关的linux基础知识分享
本文针对的人群:会用putty.SecureCRT.xhsell等工具ssh连接到自己的asch服务器上,但不怎么会执行命令的人.高手请绕路~ 本文主要围绕受托人搭建.维护涉及相关的内容进行Linux ...
- day28:hashlib
1,继续上一小节,讲解双下内置方法,双下getitem,setitem,delitem方法,是对象可以像字典一样的来访问属性 # 普通的字典是像下面这样操作的 dic = {'k' : 'v'} di ...