LAMP平台的概述
LAMP环境脚本部署:https://github.com/spdir/ShellScripts/tree/master/lamp
LAMP平台的构成组件:
- Linux操作系统
- Apache
- MySQL/mogodb
- PHP/Perl/Python
LAMP平台的优势:
- 成本低廉
- 可定制性
- 易于开发
- 方便易用
本文构成组件:Linux(CentOS6.5)、Apache、MySQL、PHP
编译安装Apache(httpd)服务
Apache的特点:开放源代码、跨平台应用、支持各种Web编程语言、模块化设计、运行非常稳定、良好的安全性
Apache源码包下载地址:http://httpd.apache.org/download.cgi
shell脚本:
#! /bin/bash #__Auther__="ZhiChao Ma" #Apache服务安装 #######################[初始化变量]####################### #Apache源码包的名称 package_name='httpd-2.2.17.tar.gz' #Apache源码包解压的路径 package_dir1='/usr/src/' #Apache源码包解压的出来的源码文件夹的名称 package_dir2='httpd-2.2.17' #Apache服务的安装目录 install_dir='/usr/local/httpd' ###########################[END]################################# #删除rpm安装的httpd包 rpm -e httpd --nodeps &> /dev/null #编译安装Apache tar zxf $package_name -C $package_dir1 cd $package_dir1$package_dir2 ./configure --prefix=$install_dir --enable-so --enable-rewrite --enable-charset-lite --enable-cig &> /dev/null make &> /dev/null make install &> /dev/null #配置 ln -s ${install_dir}/bin/* /usr/local/bin cp ${install_dir}/bin/apachectl /etc/init.d/httpd chmod +x /etc/init.d/httpd #添加系统服务 sed -i '3i#chkconfig:2345 25 25' /etc/init.d/httpd sed -i '3a#description:This is Apache Server' /etc/init.d/httpd chkconfig --add httpd chkconfig httpd on #启动服务 ${install_dir}/bin/apachectl start &> /dev/null echo 'Apache install successful'