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 /installpkgscd /installpkgs/apr-1.6.3./configure --prefix=/usr/local/apache2/installmodules/aprmake && make install#apr-util安装yum install expat-develtar -xvf /installpkgs/apr-util-1.6.1.tar.gz -C /installpkgscd /installpkgs/apr-util-1.6.1./configure --prefix=/usr/local/apache2/installmodules/apr-util --with-apr=/usr/local/apache2/installmodules/aprmake && make install#pcre安装yum install -y gcc gcc-c++tar -xvf /installpkgs/pcre-8.41.tar.gz -C /installpkgscd /installpkgs/pcre-8.41./configure --prefix=/usr/local/apache2/installmodules/pcremake && make install#mod_sslyum install openssl-devel#httpd安装tar -xvf /installpkgs/httpd-2.4.29.tar.gz -C /installpkgscd /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=preforkmake && make install#修改ServerNameif ! grep "ServerName localhost:80" /etc/httpd24/httpd.confthenecho "ServerName localhost:80" >> /etc/httpd24/httpd.conffi#apache服务启动/usr/local/apache2/bin/apachectl -k start
apache2.4一键脚本安装(linux环境)
原文地址:http://www.cnblogs.com/bloghxr/p/8017652.html