编译安装lamp之httpd

author author     2022-08-04     332

关键词:

编译安装httpd(httpd 2.4.4,相关软件包可到apache官网上下载)

# hwclock -s 将软件时间同步为硬件时间,防止安装软件时出错

1、解决依赖关系

httpd-2.4.4需要较新版本的aprapr-util,因此需要事先对其进行升级。这里使用源码包进行升级(apr-1.5.2apr-util-1.5.4

(1) 编译安装apr

# tar xf apr-1.5.2.tar.bz2

# cd apr-1.5.2

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

# make && make install

(2) 编译安装apr-util

# tar xf apr-util-1.5.4.tar.bz2

# cd apr-util-1.5.4

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

# make && make install

(3) httpd-2.4.4编译过程也要依赖于pcre-devel软件包,需要事先安装。

#yum -y install pcre-devel

(4) 可在编译安装httpd时会报错:checking for OpenSSL version >=0.9.7 ... FAILED

#yum -y install openssl-devel

#yum update openssl

2、编译安装httpd-2.4.4

# tar xf httpd-2.4.4.tar.bz2

# cd httpd-2.4.4

# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=most --with-mpm=event

(含义:--perfix=/usr/local/apache 指定安装路径;--sysconfdir=/etc/httpd 指定配置文件路径;--enable-so  apache核心装载DSO,但实际不编译任何动态模块;--enable-ssl 支持ssl模块;--enable-cgi支持cgi模块;--enable-rewrite 支持url重写;--with-zlib支持zlib库文件;--with-pcre 包含pcre函数;--with-apr=/usr/local/apr 指定apr的路径;--with-apr-util=/usr/local/apr-util 指明apr-util路径;--enable-modules=most 支持模块:支持共享模块;--with-mpm=event加载模块event

# make && make install

3、修改httpd的主配置文件,设置其Pid文件的路径

#vim /etc/httpd/httpd.conf,添加如下行即可:

PidFile  "/var/run/httpd.pid"

4、提供SysV服务脚本/etc/rc.d/init.d/httpd,内容如下:

#!/bin/bash

#

# httpd        Startup script for the Apache HTTP Server

#

# chkconfig: - 85 15

# description: Apache is a World Wide Web server.  It is used to serve

#       HTML files and CGI.

# processname: httpd

# config: /etc/httpd/conf/httpd.conf

# config: /etc/sysconfig/httpd

# pidfile: /var/run/httpd.pid

 

# Source function library.

. /etc/rc.d/init.d/functions

 

if [ -f /etc/sysconfig/httpd ]; then

        . /etc/sysconfig/httpd

fi

 

# Start httpd in the C locale by default.

HTTPD_LANG=${HTTPD_LANG-"C"}

 

# This will prevent initlog from swallowing up a pass-phrase prompt if

# mod_ssl needs a pass-phrase from the user.

INITLOG_ARGS=""

 

# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server

# with the thread-based "worker" MPM; BE WARNED that some modules may not

# work correctly with a thread-based MPM; notably PHP will refuse to start.

 

# Path to the apachectl script, server binary, and short-form for messages.

apachectl=/usr/local/apache/bin/apachectl

httpd=${HTTPD-/usr/local/apache/bin/httpd}

prog=httpd

pidfile=${PIDFILE-/var/run/httpd.pid}

lockfile=${LOCKFILE-/var/lock/subsys/httpd}

RETVAL=0

 

start() {

        echo -n $"Starting $prog: "

        LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS

        RETVAL=$?

        echo

        [ $RETVAL = 0 ] && touch ${lockfile}

        return $RETVAL

}

 

stop() {

echo -n $"Stopping $prog: "

killproc -p ${pidfile} -d 10 $httpd

RETVAL=$?

echo

[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}

}

reload() {

    echo -n $"Reloading $prog: "

    if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then

        RETVAL=$?

        echo $"not reloading due to configuration syntax error"

        failure $"not reloading $httpd due to configuration syntax error"

    else

        killproc -p ${pidfile} $httpd -HUP

        RETVAL=$?

    fi

    echo

}

 

# See how we were called.

case "$1" in

  start)

start

;;

  stop)

stop

;;

  status)

        status -p ${pidfile} $httpd

RETVAL=$?

;;

  restart)

stop

start

;;

  condrestart)

if [ -f ${pidfile} ] ; then

stop

start

fi

;;

  reload)

        reload

;;

  graceful|help|configtest|fullstatus)

$apachectl [email protected]

RETVAL=$?

;;

  *)

echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"

exit 1

esac

 

exit $RETVAL

 

而后为此脚本赋予执行权限并加入服务列表:

# chmod +x /etc/rc.d/init.d/httpd

# chkconfig --add httpd

5.提供执行相关命令所需的环境变量

#vim /etc/profile.d/httpd.sh,添加以下内容:

export PATH=$PATH:/usr/local/apache/bin

6.至此,http服务配置结束,可以启动测试了

#service httpd restart


本文出自 “10917734” 博客,请务必保留此出处http://10927734.blog.51cto.com/10917734/1851372

lamp之编译安装

...易用,但在某些特定情况下,由于有特殊需求,需要基于编译这种方式来定制化安装所需要的软件,以能特供自己所需的功能,此处我们来基于编译实现LAMP环境,来揭开编译安装这种听起来高大上的安装方式。首先来交代一下... 查看详情

lamp之自动化编译安装

...php-fpm的安装,安装高版本的数据库在centos6上也需要通过编译安装完成,本文介绍了Modules模式和FastCGI模式快速部署LAMP的包和相关操作,同时附上了一键安装的编译脚本。2 快速部署LAMP在CentOS6和7中,在Modules模式和FastCGI模式... 查看详情

编译安装lamp

题目:在LAMP架构中,请分别以php编译成httpd模块形式和php以fpm工作为独立守护进程的方式来支持httpd,列出详细的过程。本次实验以CentOS7为搭建环境,并且已经使用源码编译安装了httpd-2.4(默认使用prefork模块)和使用通用二进... 查看详情

lamp编译安装(代码片段)

lamp编译安装CentOS6:PHP-5.3.2之前:默认不支持fpm机制;需要自行打补丁并编译安装httpd-2.2:默认不支持fcgi协议,需要自行编译此模块解决方案:编译安装httpd-2.4,php-5.3.3+CentOS7:httpd-2.4:rpm包默认编译支持fcgi模块php-fpm包:专用于... 查看详情

实践作业之编译安装lamp

题目1:httpd所支持的处理模型有哪些,他们的分别使用于哪些环境。(1)prefork模型:功能:多进程模型,每个进程响应一个请求工作方式:①一个主进程:负责生成子进程及回收子进程(工作进程),负责创建套接字,负责接收... 查看详情

编译安装lamp-2(httpd)

*************安装httpd*****************1,安装 相关的包 httpd-2.4.9.tar.bz2  apr-util-1.5.3.tar.bz2  apr-1.5.0.tar.bz2 安装依赖 yuminstallpcre-devel-y 依赖都是装devel包 安装apr-1.5.0.tar.bz2 cd/usr/local t 查看详情

lamp编译安装系列

主要还是centos6.9和centos7上相应软件包的安装及编译安装。所用版本均为当前最新版。生产环境中不建议这么干,毕竟生成以稳定为主。LAMP里php是最后安装,php依赖于服务器和数据库,所以这里单独编译系列就只有httpd和mariadb了... 查看详情

编译安装httpd2.4

编译安装LAMP之:编译安装httpd2.4环境介绍:  系统环境:CentOS6.5 所需软件包:apr-1.5.2.tar.gz、apr-util-1.5.2.tar.gz、httpd-2.4.6.tar.gz  注意:httpd2.4需要依赖apr和arp-util1.4以上版本  CentOS编译安装Apache准备:确保开发包组已安... 查看详情

编译安装lamp环境

LAMP环境配置:httpd-2.4.23+mysql-5.5.51+php-5.5.38编译安装过程编译前先准备系统的开发环境:# yum groupinstall "Development tools" "Server Platform Development"一、编译安装apache1、解决依赖关系httpd-2.4.23 查看详情

编译安装lamp架构之discuz论坛(代码片段)

...、MySQL、PHP/Perl/PythonLAMP的优势成本低廉可定制、易于开发编译安装实验步骤第一步:通过Windows下载并共享LAMP软件包第二步:在Linux虚拟机上远程获取共享[root@lamp~]#smbclient-L//192.168.10.37/SharenameTypeComment--------------------LAMP-C7Disk[root@lamp~... 查看详情

在centos6.5上编译安装lamp

LAMP组合的编译安装基于centos6.5实现httpd+phpmodules把php编译成httpd的DSO对象prefork:libphp5event,worker:libphp5-ztscgifastcgifpm:php作为独立的服务httpd对fastcgi协议的支持httpd-2.2需要额外安装fcgi模块httpd-2.4自带fcgi模块 安装次序httpdMariadbp 查看详情

lamp编译安装

lamp编译安装================================================================================编译安装amp 1.编译前环境准备及相关介绍★系统环境:CentOS6,7CentOS6:apr,apr-util的版本为1.3.9,不适用于httpd-2.4的编译安装;CentOS7:apr,apr-util的 查看详情

lamp--2.apache编译安装

     apache官网下载地址:http://www.apache.org/dyn/closer.cgi。建议使用国内开源镜像地址:http://mirrors.aliyun.com/apache/httpd/httpd-2.2.31.tar.bz2 或 http://mirrors.sohu.com/apache/http 查看详情

编译安装lamp

一、编译安装apache1、解决依赖关系,先下载好这三个包httpd-2.4.9,apr-1.5.0.tar.bz2,apr-util-1.5.3.tar.bz22、准备开发环境,安装DevelopmentTools,ServerPlatformDevelopment;使用命令yumgroupinstall,这里不多阐述;3、编译安装apr-1.5.0.tar.bz24、编... 查看详情

一键编译安装lamp(代码片段)

准备工具httpd:apr-1.7.0.tar.gz,apr-util-1.6.1.tar.gz,httpd-2.4.39.tar.bz所有源码包mysql:mariadb-10.2.23.tar.gz源码包php:php-7.3.5tar.bz2源码包以上所有源码包存,以及一键安装脚本存放在root家目录下,运行一键安装脚本。脚本运行完毕,使用浏览器... 查看详情

centos6编译安装lamp

Centos6系统上编译安装lamp所有操作都是关闭防火墙和selinex的前下提先进行的httpd和php的组合方式:Modules:把php编译成httpd的DSO对象;Prefork:需要libphp5的支持Event、worker:需要libphp5-zts的支持。所以如果pmp之间需要切换工作方式的化... 查看详情

centos6lamp搭建,编译安装

搭建准备工作:CentOS6.6服务器IP:192.168.230.202软件包位置/tmp/httpdwget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.25.tar.gz ##httpd2.4.25wget https://www.openssl.org/source/openssl-1.0.1u.tar.g 查看详情

lamp

...环境为CentOS6.7httpd版本2.4.23mariadb版本5.5.36php版本5.6.26一、编译安装apache1、解决依赖关系  httpd-2.4.23新版本的apr和apr-util,因此需要事先对其进行升级。升级方式有两种,一种是通过源代码编译安装,一种是直接升级rpm包。... 查看详情