linux下lamp架构部署脚本代码
作者 佚名技术
来源 Linux系统
浏览
发布时间 2012-04-29
以下是我在rhle as5 中编写和验证通过的源码包lamp架构部署脚本的源代码,想学习Shell编程和lamp架
构部署的朋友可参考一下,脚本的解释将陆续的增加.
使用方法: 把软件包httpd-2.2.13.tar.bz2、mysql-5.1.37.tar.gz 、php-5.2.9.tar.gz,和本脚本放在同一目 录下,(建议新建一目录放置以上3个包和脚本). 软件包版本不同的,只需修改按如下格式修改3个变量 HTTP="httpd-2.2.13" MYSQL="mysql-5.1.37" PHP="php-5.2.9" 使用过程中如有任何问题和需改进之处,望告知. 以下是脚本源代码: !/bin/bash # author:maoguoqing # mail:mmyy0906@qq.com # QQ:346466186 # tel:13718234323 # welcome to use HTTP="httpd-2.2.13" MYSQL="mysql-5.1.37" PHP="php-5.2.9" ##########------------install apache--------------############# function HTTPINSTALL() { rm -rf ${HTTP} tar -xvf ${HTTP}.tar.* || exit 1 cd ${HTTP} ./configure --prefix=/usr/local/apache2 --enable-mime-magic --enable-ssl --enable-rewrite --enable-so --with-mpm=worker || exit 2 make clean make || exit 3 make install || exit4 export PATH=${PATH}:/usr/local/apache2/bin apachectl start curl -I http://localhost && echo -e "install done n httpd is running" } function REMOVE() { rpm -q httpd if [ "$?" == "0" ]; then service httpd stop rpm -e httpd || yum -y remove httpd HTTPINSTALL else /usr/local/apache2/bin/apachectl stop rm -rf /usr/local/apache2 HTTPINSTALL fi } ps -ef | grep http | grep -v grep if [ $? = 0 ]; then echo -e "ATTENTION: n httpd is already running.n remove input "y" please.n or else program will exit." read MAO if [ $MAO = y ]; then REMOVE elif [ $MAO = Y ];then REMOVE else echo "you input is "${MAO}", so I am exit." exit 99 fi else HTTPINSTALL fi ##########------------install mysql--------------############# adduser mysql mkdir -p /usr/local/mysql/data rm -rf ${MYSQL} tar xvf ${MYSQL}.tar.* || exit 11 cd ${MYSQL} ./configure --prefix=/usr/local/mysql --with-named-curses-libs=/usr/lib/libncursesw.so.5 --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock --localstatedir=/usr/local/mysql/data --enable-assembler --with-mysqld-ldflags=-all-static --with-mysqld-user=mysql || exit 12 make clean make || exit 13 make install || exit 14 chown -R mysql.mysql /usr/local/mysql /usr/local/mysql/bin/mysql_install_db --user=mysql /usr/local/mysql/bin/mysqld_safe --user=mysql & lsof -i:3306 if [ S? = 0 ];then echo -e "haha mysql install success. n mysql is runing" else echo "sorry, start fail." fi ##########------------install php--------------############# rm -rf ${PHP} tar xvf ${PHP}.tar.* || exit 31 cd ${PHP} ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysql-sock=/var/lib/mysql/mysql.sock --with-apxs2=/usr/local/apache2/bin/apxs --enable-xml --enable-dom --with-iconv --with-gd --with-openssl --enable-ftp || exit 32 make clean make || exit 33 make install || exit 34 echo "php install success." exit 0 |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
上一篇: Linux下DHCP服务器启动失败下一篇: Linux ext3文件系统 rm恢复
关于linux下lamp架构部署脚本代码的所有评论