Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1172231
  • 博文数量: 150
  • 博客积分: 2739
  • 博客等级: 少校
  • 技术积分: 2392
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-07 12:28
文章分类

全部博文(150)

文章存档

2015年(2)

2014年(16)

2013年(10)

2012年(58)

2011年(64)

分类: Python/Ruby

2014-04-25 11:14:24



Lamp一键安装脚本
说明:该脚本主要在centos 6版本以上应用,yum安装mcrypt ,mcrypt-devel方式


点击(此处)折叠或打开

  1. #!/bin/bash
  2. ##DATE 20140423
  3. ##Auther Gavin
  4. #Mail wkgbc456@163.com
  5. LOCAL=/usr/local
  6. HOME=/root
  7. DATE=`date +"%Y_%m_%d_%T"`
  8. export PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin


  9. echo -e "
  10.      The Apache,PHP,Mysql install ,The apache version 2.27,The PHP 5.2.11,The Mysql 5.1.73,The PHP install by Configure,but Apache,mysql install by yum...
  11. "
  12. read -p "Please Input y or Y install The Software, Input other exit.... " INSTALL


  13. #if getconf LONG_BIT|grep 64;then
  14. # echo -e "The System is 64bit...."
  15. # continue
  16. #else
  17. # echo -e "The System isn't 64bit,exit ....."
  18. # exit 0;
  19. #fi


  20. case $INSTALL in
  21. y|Y)


  22. rm -rf httpd-2.2.27 libmcrypt-2.5.8 mcrypt-2.6.8 mhash-0.9.9.9 php-5.2.11
  23. rm -rf $LOCAL/{apache,php}


  24. ############################Start Install#########################
  25. if rpm -qa httpd httpd-devel|grep httpd;then
  26. yum remove -y httpd httpd-devel mysql mysql-server mysql-devel
  27. rm -fr /etc/httpd /etc/php.ini
  28. fi


  29. ############################Congigure YUM #######################
  30. if getconf LONG_BIT|grep 64;then
  31.    echo -e "The System is 64bit...."
  32. rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  33. rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
  34. yum makecache
  35. else
  36. rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
  37. rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
  38. yum makecache
  39. fi




  40. yum install -y gd gcc gcc-c++ libpng libpng-devel libjpeg libjpeg-devel libxml2 libxml2-devel openssl openssl-devel curl curl-devel bzip2 bzip2-devel freetype-devel gmp-devel ncurses ncurses-devel libmcrypt libmcrypt-devel net-snmp net-snmp-devel libtool-ltdl libtool-ltdl-devel libmcrypt libmcrypt-devel mcrypt mhash mhash-devel


  41. ###########################Install Mysql##########################


  42.  if rpm -qa mysql mysql-server|grep mysql;then
  43.     echo -e "The mysql has Install ,Do nothing...."
  44.    else
  45. yum install -y mysql mysql-server mysql-devel
  46.  fi


  47. if grep "/usr/local/lib" /etc/ld.so.conf;then
  48. continue;
  49. else
  50. echo "/usr/local/lib" >>/etc/ld.so.conf
  51. ldconfig -v
  52. sleep 1
  53. ldconfig -v
  54. fi


  55. #cd $HOME
  56. ##wget http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
  57. #tar xvf mhash-0.9.9.9.tar.gz
  58. #cd mhash-0.9.9.9
  59. #./configure
  60. #[ $? == 0 ] && make || exit 1;
  61. #[ $? == 0 ] && make install || exit 1;


  62. #cd $HOME
  63. #wget http://jaist.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
  64. #tar xvf libmcrypt-2.5.8.tar.gz
  65. #cd libmcrypt-2.5.8
  66. #./configure
  67. #[ $? == 0 ] && make || exit 1;
  68. #[ $? == 0 ] && make install || exit 1;




  69. #cd $HOME
  70. #wget http://ncu.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
  71. #tar xvf mcrypt-2.6.8.tar.gz
  72. #cd mcrypt-2.6.8
  73. #./configure
  74. #[ $? == 0 ] && make || exit 1;
  75. #[ $? == 0 ] && make install || exit 1;


  76. ###################The System 32bit or 64bit...#############
  77. if getconf LONG_BIT|grep 64;then
  78.    echo -e "The System is 64bit...."
  79. ln -sv /usr/lib64/libjpeg.so /usr/lib/libjpeg.so
  80. ln -sv /usr/lib64/libpng.so /usr/lib/libpng.so
  81. ln -sv /usr/lib64/mysql/libmysqlclient.so /usr/lib/
  82. else
  83.    echo -e "The System 32bit, ....."
  84. fi




  85. ######################################################
  86. read -p "if you want Confiugre HTTP ,Input c or C ; input other,yum install HTTP... " HTTP


  87. ##################The Congigur PHP################
  88. if [ $HTTP == "c" ] || [ $HTTP == "C" ;then


  89. yum remove -y httpd httpd-devel php php-mysql
  90. cd $HOME
  91. wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.2.27.tar.gz
  92. tar xvf httpd-2.2.27.tar.gz
  93. cd httpd-2.2.27
  94. ./configure --prefix=$LOCAL/apache --enable-cgi --enable-rewrite --enable-ssl --enable-so --enable-so -enable-mods-shared=all --enable-modules=all
  95. [ $? == 0 ] && make || exit 1;
  96. [ $? == 0 ] && make install || exit 1;




  97. ################The Congiure PHP#######################
  98. cd $HOME
  99. #export LDFLAGS=-L/usr/lib64/mysql
  100. wget http://museum.php.net/php5/php-5.2.11.tar.bz2
  101. tar xvf php-5.2.11.tar.bz2
  102. cd php-5.2.11
  103. ./configure --prefix=$LOCAL/apache --with-apxs2=$LOCAL/apache/bin/apxs --with-config-file-path=/etc --with-mysql=/usr/ --with-iconv-dir --with-freetype-dir --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib=/usr --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-magic-quotes --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt=/usr/ --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic
  104. [ $? == 0 ] && make || exit 1;
  105. [ $? == 0 ] && make install || exit 1;


  106. ###############Configure http config##############################
  107. CONF=$LOCAL/apache/conf/httpd.conf
  108. if grep "application/x-httpd-php" $CONF;then
  109.    continue;
  110. else
  111. cp $LOCAL/apache/conf/{httpd.conf,httpd.conf.$DATE}
  112. sed -i 's/DirectoryIndex index.html/DirectoryIndex index.html index.php/g' $CONF || exit 1;
  113. sed -i "362a AddType application/x-httpd-php .php" $CONF || exit 1;
  114. sed -i "362a AddType application/x-httpd-php-source .phps" $CONF || exit 1;
  115. fi


  116.   if grep apache /etc/rc.local;then
  117.     echo -e "The apachectl exist ...."
  118.     else
  119.     echo "$LOCAL/apache/bin/apachectl restart" >>/etc/rc.local
  120.   fi


  121. echo -e "The Apache Server Starting....."
  122. $LOCAL/apache/bin/apachectl restart


  123. else
  124. yum install -y httpd httpd-devel


  125. ##########################Configure PHP 5.2.11 ########


  126. cd $HOME
  127. #export LDFLAGS=-L/usr/lib64/mysql
  128. wget http://museum.php.net/php5/php-5.2.11.tar.bz2
  129. tar xvf php-5.2.11.tar.bz2
  130. cd php-5.2.11
  131. ./configure --prefix=$LOCAL/php --with-apxs2=/usr/sbin/apxs --with-config-file-path=/etc --with-mysql=/usr/ --with-iconv-dir --with-freetype-dir --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib=/usr --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-magic-quotes --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt=/usr/ --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic
  132. [ $? == 0 ] && make || exit 1;
  133. [ $? == 0 ] && make install || exit 1;
  134. cp php.ini-dist /etc/php.ini
  135. cd $HOME


  136. ###############Configure http config##############################
  137. CONF=/etc/httpd/conf/httpd.conf
  138.  if grep "application/x-httpd-php" $CONF;then
  139.    continue;
  140. else
  141. cp /etc/httpd/conf/{httpd.conf,httpd.conf.$DATE}
  142. sed -i 's/DirectoryIndex index.html index.html.var/DirectoryIndex index.html index.html.var index.php/g' $CONF
  143. sed -i "781a AddType application/x-httpd-php .php" $CONF
  144. sed -i "781a AddType application/x-httpd-php-source .phps" $CONF
  145.  fi


  146. echo -e "The Apache Server Starting....."
  147. chkconfig httpd on
  148. service httpd restart


  149. fi


  150. ###########Install ZendOptimer########################
  151.  if grep "ZendOptimizer.so" /etc/php.ini;then
  152.     echo -e "The PHP.ini has ZendOptimizer.so...."
  153.     continue;
  154.  else
  155. wget http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
  156. mkdir -pv /usr/local/php/extension
  157. tar xvf ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
  158. cp ZendOptimizer-3.3.9-linux-glibc23-x86_64/data/5_2_x_comp/ZendOptimizer.so /usr/local/php/extension/
  159. cat >>/etc/php.ini<<EOF
  160. [Zend]
  161. zend_extension = "/usr/local/php/extension/ZendOptimizer.so"
  162. EOF
  163.  fi


  164. ##########Install PHPmyadmin##########################
  165. #wget http://jaist.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.13/phpMyAdmin-4.1.13-all-languages.zip
  166. #unzip phpMyAdmin-4.1.13-all-languages.zip




  167. echo -e "The Mysql Server Starting....."
  168. chkconfig mysqld on
  169. service mysqld restart


  170. echo -e "
  171.         The Apache 2.22 Install Successfull....
  172.         The Mysql 5.1.13 Install Sucessfull....
  173.         The PHP 5.2.11 Install Successfull...
  174. "


  175. ######################################################
  176. ;;
  177. *)
  178.    echo -e "The Shell exit ....."
  179. ;;
  180. esac




阅读(1805) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

随风飘云2014-04-25 13:06:17