上一篇:搭建LNAMP环境(二)- 源码安装Nginx1.10

1.yum安装编译apache需要的包(如果已经安装,可跳过此步骤)

yum -y install pcre pcre-devel zlib zlib-devel openssl openssl-devel

2.创建apache用户组和用户

groupadd apache
useradd -r -g apache -s /sbin/nologin -M apache

3.下载apache源码包及依赖包apr和apr-util,将它们放到/usr/local/src/目录下

源码包下载页面:http://httpd.apache.org/download.cgi
依赖包下载页面:http://apr.apache.org/download.cgi
这里用的是 httpd-2.4.23.tar.gz ,apr-1.5.2.tar.gz ,apr-util-1.5.4.tar.gz
apache下载地址:    http://apache.fayea.com/httpd/httpd-2.4.23.tar.gz
apr下载地址:         http://apache.fayea.com/apr/apr-1.5.2.tar.gz
apr-util下载地址:   http://apache.fayea.com/apr/apr-util-1.5.4.tar.gz

4.进入src/目录

cd /usr/local/src/

5.解压apache源码包及依赖包

tar -zxf httpd-2.4..tar.gz
tar -zxf apr-1.5..tar.gz
tar -zxf apr-util-1.5..tar.gz

6.编译安装apr

cd /usr/local/src/apr-1.5.

./configure --prefix=/usr/local/apr

make && make install

注:如果./configure时出现报错:
error info:rm: cannot remove `libtoolT': No such file or directory
解决方法:
打开configure文件
vim configure
找到
 $RM "$cfgfile"
改为
 $RM -f "$cfgfile"
保存后再次执行即可

7.编译安装apr-util

cd /usr/local/src/apr-util-1.5.

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/

make && make install

8.编译安装apache(配置参数:http://httpd.apache.org/docs/2.4/programs/configure.html

cd /usr/local/src/httpd-2.4.

./configure \
--prefix=/usr/local/apache \
--sysconfdir=/usr/local/apache/conf \
--enable-so \
--enable-cgi \
--enable-deflate \
--enable-rewrite \
--enable-modules=most \
--enable-mpms-shared=all \
--enable-ssl \
--with-ssl \
--with-z \
--with-pcre \
--with-zlib \
--with-mpm=event \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util/ make && make install

9.修改apache配置文件httpd.conf

vim /usr/local/apache/conf/httpd.conf

10.修改为下面内容,保存退出

#如果前面已经安装了nginx,为防止端口冲突,这里改为其他端口
Listen 8088 #用户组和用户改为apache
User apache
Group apache #ServerName www.example.com:80
ServerName 127.0.0.1

11.修改apache目录权限

chown -R apache:apache /usr/local/apache

12.将apache服务脚本加入到init.d/目录

cp /usr/local/apache/bin/apachectl /etc/init.d/httpd

13.修改脚本httpd

vim /etc/init.d/httpd

14.在首行 #!/bin/sh 下面加入两行:

# chkconfig: 345 85 15
# description: Activates/Deactivates Apache Web Server

第一行3个数字参数意义分别为:哪些Linux级别需要启动httpd(3,4,5);启动序号(85);关闭序号(15)

15.将apache加入系统服务

chkconfig --add httpd

16.修改服务的默认启动等级

chkconfig httpd on

17.启动apache

service httpd start

访问URL,如:http://192.168.8.9:8088/
页面显示正常,则配置成功

Apache安装完毕!

下一篇:搭建LNAMP环境(四)- 源码安装PHP7

搭建LNAMP环境(三)- 源码安装Apache2.4的更多相关文章

  1. Linux环境下源码安装Apache2.2.25

    操作环境:RedHat Enterprise Linux 5.6 一.安装准备 安装Apache一般依赖3个组件:apr.apr-util.pcre. 确保这三个组件已经安装. [root@bigsr ...

  2. 在ConoHa上Centos7环境下源码安装部署LNMP

    本文记录了从源码,在Centos 7上手动部署LNMP环境的过程,为了方便以后对nginx和mariadb进行升级,这里采用yum的方式进行安装. 1.建立运行网站和数据库的用户和组 groupadd ...

  3. CentOS7.3环境下源码安装httpd

    CentOS7.3环境下源码安装httpd 本文在CentOS7.3下,源码安装apache服务httpd2.4. 1.下载好源码安装包 [root@localhost ~]#ll total 625 ...

  4. CentOS下源码安装Apache2.4+PHP5.4+MySQL5.5

    一.准备(把所有的源文件放在‘/home/yuanjun’目录下) apr http://mirror.bjtu.edu.cn/apache/apr/apr-1.4.6.tar.gz apr-util ...

  5. LNAMP服务器环境(源码安装)

    在安装前先看下它们安装时所需要的依赖库:http://www.cnblogs.com/fps2tao/p/7699448.html 1.nginx源码安装 下载:http://nginx.org/en ...

  6. Linux环境下源码安装PostgreSQL

    1.下载PostgreSQL源码包,并保存到Linux操作系统的一个目录下 2.解压PostgreSQL源码包 :tar zxvf postgresql-9.2.4.tar.gz 或 tar jxvf ...

  7. 搭建LNAMP环境(二)- 源码安装Nginx1.10

    上一篇:搭建LNAMP环境(一)- 源码安装MySQL5.6 1.yum安装编译nginx需要的包 yum -y install pcre pcre-devel zlib zlib-devel ope ...

  8. 搭建LNAMP环境(四)- 源码安装PHP7

    上一篇:搭建LNAMP环境(三)- 源码安装Apache2.4 一.安装PHP7 1.yum安装编译php需要的包 yum -y install libxml2 libxml2-devel curl- ...

  9. gitlab 源码安装=》rpm安装横向迁移(version 9.0)

    准备: 下载版本地址: https://packages.gitlab.com/gitlab/gitlab-ce 迁移环境: 源码安装的gitlab9.0.13 目标迁移至9.0.13 RPM安装的环 ...

随机推荐

  1. import sun.net.www.MimeTable报错

    我原以为是要导什么jar包,仔细一看是 Access restriction: The type * is not accessible due to restriction on required ...

  2. Xcode 8 Simulator Stop Logging too much info

    按照以下内容设置即可:

  3. [转]webpack

    什么是 webpack? webpack是近期最火的一款模块加载器兼打包工具,它能把各种资源,例如JS(含JSX).coffee.样式(含less/sass).图片等都作为模块来使用和处理. 我们可以 ...

  4. Arduino下LCD1602综合探究(上)——1602的两种驱动方式,如何使LCD的控制编程变得更简单

    一.前言: LCD ( Liquid Crystal Display 的简称)液晶显示器,已经逐渐替代CRT成为主流的显示设备之一,因此也成为了单片机发烧友绕不过的话题之一:而LCD1602更是很多单 ...

  5. 【Linux】Linux统计文件夹、文件数量的命令

    # 查看当前目录下的文件数量(不包含子目录中的文件) ls -l|grep "^-"| wc -l # 查看当前目录下的文件数量(包含子目录中的文件) 注意:R,代表子目录 ls ...

  6. 【BZOJ3943】[Usaco2015 Feb]SuperBull 最小生成树

    [BZOJ3943][Usaco2015 Feb]SuperBull Description Bessie and her friends are playing hoofball in the an ...

  7. React虚拟DOM浅析

    在Web开发中,需要将数据的变化实时反映到UI上,这时就需要对DOM进行操作,但是复杂或频繁的DOM操作通常是性能瓶颈产生的原因,为此,React引入了虚拟DOM(Virtual DOM)的机制. 什 ...

  8. Oracle Flashback 闪回

    Oracle 的闪回技术是一种数据恢复技术,仅能对用户逻辑错误进行恢复, 闪回针对的是提交commit的事务,没有提交的事务,使用rollback 1.闪回版本查询 Flashback Version ...

  9. [svg 翻译教程]Polyline(折线)polygon(多边形)

    原文: http://tutorials.jenkov.com/svg/polygon-element.html Polyline 虽然说这个 元素我没用过,但是还是蛮强大的,也翻译下 示例 < ...

  10. 踏上Salesforce的学习之路(三)

    一.创建Invoice对象 为了使我们的这个Warehouse app更加接近现实,我们现在为他创建一个Invoice对象. 先点击右上角的Setup,然后在左侧的Quick Find查找框中输入Ob ...