有来技术官方博客,推荐关注微信公|

有来技术

园龄:10年5个月粉丝:831关注:15

apache2.4脚本一键安装(linux环境)

1.下载apache安装包和相关组件

下载地址:https://pan.baidu.com/s/1o85i6Jw

其中包括

apache安装包:httpd-2.4.29.tar.gz

apache安装所需其他模块:apr-1.6.3.tar.gz、apr-util-1.6.1.tar.gz、pcre-8.41.tar.gz

apache一键安装脚本:install_apache24.sh

2.安装准备

root身份登录,创建安装文件上传目录

# mkdir /installpkgs

上传以上下载的5个文件至该目录( /installpkgs)下 

3.执行脚本

# cd /installpkgs

# chmod  755  install_apache24.sh

# sh install_apache24.sh

 执行过程中会有3次yum下载安装其他软件 输入"y"回车即可

4.结果演示

执行完安装之后,确定防火墙已关闭或已开放80端口

关闭防火墙:

此次生效:# service iptables stop

重启后生效:# chkconfig iptables off

输入ip地址可以看到如下界面,说明apache安装成功,脚本就是这么几步,不然正常安装可能提示少了这些哪些模块什么的(apache2.4版本的没集成apr、apr-util、pcre模块,需要另行下载)

附:脚本说明

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
#apr安装
tar -xvf /installpkgs/apr-1.6.3.tar.gz -C /installpkgs
cd /installpkgs/apr-1.6.3
./configure --prefix=/usr/local/apache2/installmodules/apr
make && make install
 
#apr-util安装
yum install expat-devel
tar -xvf /installpkgs/apr-util-1.6.1.tar.gz -C /installpkgs
cd /installpkgs/apr-util-1.6.1
./configure --prefix=/usr/local/apache2/installmodules/apr-util --with-apr=/usr/local/apache2/installmodules/apr
make && make install
 
#pcre安装
yum install -y gcc gcc-c++
tar -xvf /installpkgs/pcre-8.41.tar.gz -C /installpkgs
cd /installpkgs/pcre-8.41
./configure --prefix=/usr/local/apache2/installmodules/pcre
make && make install
 
#mod_ssl
yum install openssl-devel
 
#httpd安装
tar -xvf /installpkgs/httpd-2.4.29.tar.gz -C /installpkgs
cd /installpkgs/httpd-2.4.29
./configure \
--prefix=/usr/local/apache2 \     #apache安装目录
--sysconfdir=/etc/httpd24 \       #apache配置文件目录
--enable-so \
--enable-ssl \
--enable-cgi \
--enable-rewrite \
--with-zlib \
--with-pcre=/usr/local/apache2/installmodules/pcre \
--with-apr=/usr/local/apache2/installmodules/apr \
--with-apr-util=/usr/local/apache2/installmodules/apr-util \
--enable-modules=most \
--enable-mpms-shared=all \
--with-mpm=prefork
make && make install
 
#修改ServerName
if ! grep "ServerName localhost:80" /etc/httpd24/httpd.conf
then
echo "ServerName localhost:80" >> /etc/httpd24/httpd.conf
fi
 
#apache服务启动
/usr/local/apache2/bin/apachectl -k start

 

本文作者:有来技术

本文链接:https://www.cnblogs.com/haoxianrui/p/8017652.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   有来技术  阅读(941)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起