httpd-2.4.54编译安装

Apache至少需要apr、apr-util、pcre组件的支持
编译安装APR(也可yum install apr*)
下载地址:https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.gz  
官方网站:http://apr.apache.org/download.cgi
cd  /usr/local/src
wget  https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.gz  
tar  -zxf  apr-1.7.0.tar.gz
cd  apr-1.7.0
将configure 文件中RM='$RM' 修改为RM='$RM -f' 然后重新执行
./configure  --prefix=/usr/local/apr
make  &&  make install

编译安装APR-util:
下载地址:https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
官方网站:http://apr.apache.org/download.cgi
tar  -zxf  apr-util-1.6.1.tar.gz
cd  apr-util-1.6.1
./configure  --prefix=/usr/local/apr-util  --with-apr=/usr/local/apr/bin/apr-1-config
make  &&  make install
编译apr-util的时候,报如下错误,缺少expat库。
yum install expat-devel -y
自己动手,最后在https://launchpad.net/ubuntu/+source/expat/2.0.1-7.2ubuntu1.4找到了expat_2.0.1.orig.tar.gz包
解压后进入解压目录
./configure
make
make install


编译安装PCRE:
官方网站:http://pcre.org/
下载地址:http://jaist.dl.sourceforge.net/project/pcre/pcre/8.37/pcre-8.37.tar.gz
cd /usr/local/src
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.37/pcre-8.37.tar.gz
tar -zxf pcre-8.37.tar.gz
cd pcre-8.37
./configure --prefix=/usr/local/pcre
make  &&  make  install

编译安装Apache
官方网站:http://httpd.apache.org/
下载地址:https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.54.tar.gz
cd  /usr/local/src
wget  https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.54.tar.gz
tar  -zxf  httpd-2.4.54.tar.gz
cd httpd-2.4.54
./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/bin/pcre-config
make  &&  make  install

启动和停止Apache
使用httpd命令控制Apache,执行以下命令:
# /usr/local/apache/bin/httpd -k start
# /usr/local/apache/bin/httpd -k stop

使用脚本控制Apache,执行以下命令:
# /usr/local/apache/bin/apachectl start
# /usr/local/apache/bin/apachectl stop
设置Apache开机启动
1、将apachectl命令拷贝到/etc/init.d目录下,改名为httpd
[[email protected] ~]# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd

2、编辑/etc/init.d/httpd文件,在第1行#!/bin/sh的后面添加如下两行
[[email protected] ~]# vi /etc/init.d/httpd
# chkconfig: 2345 70 30
# description: Apache
其中,所增加的第二行中三个数字,第一个表示在运行级别2345下启动Apache,第二、三是关于启动和停止的优先级配置,无关紧要。
3、Apache服务尚未被添加到chkconfig列表中,需要使用–add参数将其添加进去
[[email protected] ~]# chkconfig –add httpd
[[email protected] ~]# chkconfig –list httpd
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use ‘systemctl list-unit-files’.
To see services enabled on particular target use
‘systemctl list-dependencies [target]’.
httpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
posted @   星尘yuan  阅读(1006)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示