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模块,需要另行下载)

附:脚本说明

#!/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

apache2.4脚本一键安装(linux环境)的更多相关文章

  1. LNMP1.3一键安装Linux环境,配置Nginx运行ThinkPHP3.2

    LNMP1.3一键安装Linux环境,配置Nginx运行ThinkPHP3.2 你是否遇见过:安装LNMP1.3环境后,运行ThinkPHP 3.2,只能打开首页,不能访问控制器,报404错误. 按照 ...

  2. Shell脚本一键安装LNMP环境

    https://sourceforge.net/projects/opensourcefile/files/ Nginx是一款高性能的HTTP和反向代理服务器.Nginx在反向代理,Rewrite规则 ...

  3. Linux一键安装web环境全攻略phpstudy版

    此教程主要是应对阿里云Linux云服务器ecs的web环境安装,理论上不限于阿里云服务器,此教程对所有Linux云服务器都具有参考价值. 写这篇文章的目的:网上有很多关于Linux一键安装web环境全 ...

  4. Linux一键安装LNMP环境

    Linux一键安装LNMP环境 官方地址:https://lnmp.org/. 参考安装步骤:https://lnmp.org/install.html. 一键安装可以选择mysql版本.php版本, ...

  5. 安装完Ubuntu后通过shell脚本一键安装软件

    安装完Ubuntu后通过shell脚本一键安装软件 以下代码中#是单行注释 :<<! ! 是多行注释. 运行的时候需要把多行注释去掉. 比如把以下代码保存为install.sh, 那么在终 ...

  6. shell脚本一键安装mysql5.7.x

    使用脚本一键安装mysql5.7.x,初始化数据库.启动数据库---- mysql版本号:源代码mysql5.7.10 linux版本号:centos6.5 x86_64 #!/bin/bash GR ...

  7. shell脚本一键安装mysql5.7.x(免安装版)

    使用脚本一键安装mysql5.7.x,初始化数据库,启动数据库---- mysql版本:源码mysql5.7.10 linux版本:centos6.5 x86_64 #!/bin/bash GROUP ...

  8. legend2---lamp.sh一键安装lamp环境需要爬的坑

    legend2---lamp.sh一键安装lamp环境需要爬的坑 一.总结 一句话总结: 1.要记得更改项目权限:chown -R apache:apache /data/www/default/网站 ...

  9. Centos 6.4上面用Shell脚本一键安装vsftpd

    Centos 6.4上面用Shell脚本一键安装vsftpd install.sh #!/bin/bash if [ `uname -m` == "x86_64" ];then m ...

随机推荐

  1. 2018.10.21 codeforces1071B. Minimum path(dp+贪心+bfs)

    传送门 唉考试的时候写错了两个细节调了一个多小时根本没调出来. 下来又调了半个小时才过. 其实很简单. 我们先dpdpdp出最开始最多多少个连续的aaa. 然后对于没法继续连续下去的用贪心+bfsbf ...

  2. 2018.10.05 NOIP模拟 阶乘(简单数论)

    传送门 签到题. 直接把所有数先质因数分解. 同时统计每一个在阶乘中会出现的质数出现的最少次数. 然后对于每一个这样的质数,我们求出满足其出现质数的m的最小值,然后求出所有m的最大值. 求m的时候可以 ...

  3. hdu-1877(大数+进制转换)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1877 思路:注意考虑0,0的情况. #include<iostream> #include ...

  4. spring boot web项目在IDEA下热部署解决办法(四步搞定)

    最近在用spring boot 做一个web站点,修改了类.html.js等,刷新页面,没有生效,非要手动去make一下或者重启,大大降低了开发效率. 什么是热部署? 应用启动后会把编译好的Class ...

  5. hadoop学习笔记(四):hdfs常用命令

    一.hadoop fs 1.创建目录 [root@master hadoop-]# hadoop fs -mkdir /testdir1 [root@master hadoop-]# hadoop f ...

  6. (并查集 建立关系)食物链 -- POJ-- 1182

    链接: http://poj.org/problem?id=1182 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82830#probl ...

  7. DagScheduler 和 TaskScheduler

    DagScheduler 和 TaskScheduler 的任务交接 spark 调度器分为两个部分, 一个是 DagScheduler, 一个是 TaskScheduler, DagSchedule ...

  8. PHP环境的搭建及与nginx的集成

    1.  去php官网下载最新稳定版(最新其实是7.0,为了兼容性,使用5.6.16) wget http://cn2.php.net/get/php-5.6.16.tar.gz/from/this/m ...

  9. matlab toolboxes 大全

    MATLAB Toolboxes top (Top) Audio - Astronomy - BiomedicalInformatics - Chemometrics  - Chaos - Chemi ...

  10. LinkServer--在Job中使用Linkserver注意事项

    如果要使用job来调用link server的话,不能使用作业步骤属性高级选项中”作为以下用户运行“来以本地登录用户模拟远程用户访问远程服务器.会报”无法建立安全上下文“的错误. 将Job中代码封装到 ...