1.apr和apr-util,下载地址: http://apr.apache.org/download.cgi

yum install gcc
yum install libtool
yum install expat-devel
yum install pcre-devel cd apr-1.6.3/
./configure --prefix=/opt/apr

出现以下错误

rm: cannot remove 'libtoolT': No such file or directory

include/arch/unix/apr_private.h is unchange
cp configure ./configure.bak
vi configure
#$RM “$cfgfile” #注释掉这行
:wq !./configure --prefix #重新执行上一次相同的命令
make -j 4 #四核运行
make install tar -zxvf apr-util-1.6.1.tar.bz2 #注意不要下载apr-util-1.6.1.tar.gz这个gz文件会出现安装错误
cd apr-util-1.6.1
./configure --prefix=/opt/apr-util --with-apr=/opt/apr
make && make instal

2. 下载安装pcre【如果以及yum安装则跳过此步】

wget https://ftp.pcre.org/pub/pcre/pcre2-10.30.tar.gz
tar -zxvf pcre2-10.30.tar.gz
cd pcre2-10.30
./configure --prefix=/opt/pcre
make && make install

yum -y install pcre-devel

3.安装apache

./configure --prefix=/opt/apache --with-apr=/opt/apr --with-apr-util=/opt/apr-util --with-include-apr --enable-so
make && make install

4.你会发现apache stop|restart|start都不成功

Could not reliably determine the server's fully qualified domain name

解决办法

vi httpd.conf
#ServerName www.example.com:
#修改为
ServerName localhost:

5.将apache设定为开机启动

注册Apache到Linux服务
在Linux下用源代码方式编译安装完Apache后,启动关闭Apache可以通过如下命令实现:

/opt/apache/bin/apachectl start|stop|restart

加入开机启动

cp /opt/apache/bin/apachectl  /etc/rc.d/init.d/httpd
#链接文件的S61是启动时的序号。
#当init.d目录下有httpd脚本后,我们就可以通过service命令来启动关闭apache了。
ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S61httpd
service httpd start | stop | restart

这时有个问题就是:虽然apache已经可以自动启动,但在linux的服务列表中却看不到它,要添加服务,一般通过chkconfig --add xxx来实现,但需要脚本中有相应的信息才行,否则chkconfig就会提示:xxx 服务不支持 chkconfig。所以我们首先编辑httpd脚本,在第2行(#!/bin/sh下面)添加如下注释信息(包括#):

vi /etc/rc.d/init.d/httpd
# chkconfig:
# description: Apache

第一行的3个参数意义分别为:在哪些运行级别启动httpd(3,5);启动序号(S61);关闭序号(K61)。注意:第二行的描述必须要写!保存后执行:

chkconfig --add httpd #所有开机模式下自启动,另外chkconfig httpd on 表示345模式下自启动

就将httpd添加入服务了。在rc3.d、rc5.d路径中将来就会出现S61httpd的链接,其他运行级别路径中会出现K61httpd的链接。

运行下面的命令查看服务,就可以看到httpd的服务了。

chkconfig --list

apache源码安装的更多相关文章

  1. apache源码安装 转载

    转载 1.先进入/usr/local/中创建三个文件夹 apr apr-util apache cd /usr/local目录 mkdir apr mkdir apr-util mkdir apach ...

  2. apache源码安装必须依赖的库apr----/etc/ld.so.conf 文件介绍

    Apache所依赖的库,封装了各个系统相关的API等.虽然都是Apache开发的,但是现在最新版本的Apache和APR源码是分开的.要编Apache就必须使用APR. /etc/ld.so.conf ...

  3. Apache源码安装--httpd-2.2.34

    一.下载源码包 二.将源码包移动/usr/src/目录 三.解压源码包,并进入目录:tar -xzvf httpd-2.2.34.tar.gz,cd httpd-2.2.34 四.安装依赖包:yum ...

  4. centos apache源码安装过程记录

    1.下载相关源文件 wget http://mirror.bjtu.edu.cn/apache/httpd/httpd-2.4.18.tar.gzwget http://mirrors.hust.ed ...

  5. win7 php5.5 apache 源码安装 imagick扩展

    最近公司项目有用到php 的imagick,折腾了好长时间才把扩展装上,最主要的就是最新的不一定是最合适的,最开始一直找最新包安装,一直都不成功,经过google了好长时间,终于找到一个有用的,灵机一 ...

  6. Apache 源码安装

    8.20]# make[root@yahoo pcre-8.20]# make install 二.安装apache1.下载httpd-2.4.3.tar.gz,地址是:http://httpd.ap ...

  7. linux下源码安装apache服务

    1.搭建静态网站是,我们只需要搭建apache服务即可满足要求. 例如:如果我再客户端游览器输入地址,他会找到192.168.1.100这个服务器,然后根据端口会找到apache服务器.apache他 ...

  8. 烂泥:php5.6源码安装与apache集成

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. apache对php的支持是通过apache的mod_php5模块来支持的,这点与nginx不同.nginx是通过第三方的fastcgi处理器才可以对p ...

  9. 烂泥:源码安装apache

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. 最近要开始学习nagios监控方面的知识了,但是nagios与apache结合的比较紧密,所以本篇文章就先把apache的源码安装学习下. 我们现在分以 ...

随机推荐

  1. Django的RestfulAPI框架RestFramework

    Django的Restful-API框架 安装框架 #sudo pip3 install django #sudo pip3 install markdown #sudo pip3 install d ...

  2. MVC验证

    前言 MVC自己的验证机制,通过一个案例记录学习的成果. 首先,model代码如下: public class Students    {        [Display(Name = "I ...

  3. Docker 容器管理:rancher

    Rancher:https://www.cnrancher.com/ 是一个开源的企业级全栈化容器部署及管理平台. 定位上和 K8s 比较接近,都是通过 web 界面赋予完全的 docker 服务编排 ...

  4. Python2.7设置在shell脚本中自动补全功能的方法

    1.新建tab.py文件 #!/usr/bin/env python # python startup file import sys import readline import rlcomplet ...

  5. 获取验证码随机字符串@return string $captcha,随机验证码文字

    <?php//验证码工具类class Captcha{//属性private $width;private $height;private $fontsize;private $pixes;pr ...

  6. HDU 2819 - Swap - [二分图建模+最大匹配]

    题目链接:https://cn.vjudge.net/problem/HDU-2819 Given an N*N matrix with each entry equal to 0 or 1. You ...

  7. java重载和重载的区别

    重载 public class A{     public void test(){}     public void test(int num){}     public void test(Str ...

  8. jeb 下载

    jeb-1.5.201408040(full)_keygen_by_scz(20150725) http://scz.617.cn/ 修改jeb_wincon.bat 中java home 变量,然后 ...

  9. Silver Cow Party---poj3268(最短路,迪杰斯特拉)

    Silver Cow Party Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u De ...

  10. js判断字符串长度

    方法1: String.prototype.gblen = function() { var len = 0; for (var i=0; i<this.length; i++) { if (t ...