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

全部博文(150)

文章存档

2015年(2)

2014年(16)

2013年(10)

2012年(58)

2011年(64)

分类: Python/Ruby

2014-04-25 13:08:59


一键安装LAMP--编译安装mcrypt ,mcrypt-devel方式

说明:该脚本主要在centos 6版本以上应用,编译安装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


  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. ################Configure http config##############################
  48. #CONF=/etc/httpd/conf/httpd.conf
  49. #if grep "application/x-httpd-php" $CONF;then
  50. # continue;
  51. #else
  52. #cp /etc/httpd/conf/{httpd.conf,httpd.conf.$DATE}
  53. #sed -i 's/DirectoryIndex index.html index.html.var/DirectoryIndex index.html index.html.var index.php/g' $CONF
  54. #sed -i "781a AddType application/x-httpd-php .php" $CONF
  55. #sed -i "781a AddType application/x-httpd-php-source .phps" $CONF
  56. #fi


  57. if grep "/usr/local/lib" /etc/ld.so.conf;then
  58. continue;
  59. else
  60. echo "/usr/local/lib" >>/etc/ld.so.conf
  61. ldconfig -v
  62. sleep 1
  63. ldconfig -v
  64. fi


  65. cd $HOME
  66. wget http://nchc.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
  67. tar xvf mhash-0.9.9.9.tar.gz
  68. cd mhash-0.9.9.9
  69. ./configure
  70. [ $? == 0 ] && make || exit 1;
  71. [ $? == 0 ] && make install || exit 1;


  72. cd $HOME
  73. wget http://jaist.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
  74. tar xvf libmcrypt-2.5.8.tar.gz
  75. cd libmcrypt-2.5.8
  76. ./configure
  77. [ $? == 0 ] && make || exit 1;
  78. [ $? == 0 ] && make install || exit 1;




  79. cd $HOME
  80. wget http://ncu.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
  81. tar xvf mcrypt-2.6.8.tar.gz
  82. cd mcrypt-2.6.8
  83. ./configure
  84. [ $? == 0 ] && make || exit 1;
  85. [ $? == 0 ] && make install || exit 1;


  86. ###################The System 32bit or 64bit...#############
  87. if getconf LONG_BIT|grep 64;then
  88.    echo -e "The System is 64bit...."
  89. ln -sv /usr/lib64/libjpeg.so /usr/lib/libjpeg.so
  90. ln -sv /usr/lib64/libpng.so /usr/lib/libpng.so
  91. ln -sv /usr/lib64/mysql/libmysqlclient.so /usr/lib/
  92. else
  93.    echo -e "The System 32bit, ....."
  94. fi




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


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


  99. yum remove -y httpd httpd-devel php php-mysql
  100. cd $HOME
  101. wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.2.27.tar.gz
  102. tar xvf httpd-2.2.27.tar.gz
  103. cd httpd-2.2.27
  104. ./configure --prefix=$LOCAL/apache --enable-cgi --enable-rewrite --enable-ssl --enable-so --enable-so -enable-mods-shared=all --enable-modules=all
  105. [ $? == 0 ] && make || exit 1;
  106. [ $? == 0 ] && make install || exit 1;




  107. ################The Congiure PHP#######################
  108. cd $HOME
  109. #export LDFLAGS=-L/usr/lib64/mysql
  110. wget http://museum.php.net/php5/php-5.2.11.tar.bz2
  111. tar xvf php-5.2.11.tar.bz2
  112. cd php-5.2.11
  113. ./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/local/lib --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
  114. [ $? == 0 ] && make || exit 1;
  115. [ $? == 0 ] && make install || exit 1;


  116. ###############Configure http config##############################
  117. CONF=$LOCAL/apache/conf/httpd.conf
  118. if grep "application/x-httpd-php" $CONF;then
  119.    continue;
  120. else
  121. cp $LOCAL/apache/conf/{httpd.conf,httpd.conf.$DATE}
  122. sed -i 's/DirectoryIndex index.html/DirectoryIndex index.html index.php/g' $CONF || exit 1;
  123. sed -i "362a AddType application/x-httpd-php .php" $CONF || exit 1;
  124. sed -i "362a AddType application/x-httpd-php-source .phps" $CONF || exit 1;
  125. fi


  126.   if grep apache /etc/rc.local;then
  127.     echo -e "The apachectl exist ...."
  128.     else
  129.     echo "$LOCAL/apache/bin/apachectl restart" >>/etc/rc.local
  130.   fi


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


  133. else
  134. yum install -y httpd httpd-devel


  135. ##########################Configure PHP 5.2.11 ########


  136. cd $HOME
  137. #export LDFLAGS=-L/usr/lib64/mysql
  138. wget http://museum.php.net/php5/php-5.2.11.tar.bz2
  139. tar xvf php-5.2.11.tar.bz2
  140. cd php-5.2.11
  141. ./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/local/lib --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
  142. [ $? == 0 ] && make || exit 1;
  143. [ $? == 0 ] && make install || exit 1;
  144. cp php.ini-dist /etc/php.ini
  145. cd $HOME


  146. ###############Configure http config##############################
  147. CONF=/etc/httpd/conf/httpd.conf
  148.  if grep "application/x-httpd-php" $CONF;then
  149.    continue;
  150. else
  151. cp /etc/httpd/conf/{httpd.conf,httpd.conf.$DATE}
  152. sed -i 's/DirectoryIndex index.html index.html.var/DirectoryIndex index.html index.html.var index.php/g' $CONF
  153. sed -i "781a AddType application/x-httpd-php .php" $CONF
  154. sed -i "781a AddType application/x-httpd-php-source .phps" $CONF
  155.  fi


  156. echo -e "The Apache Server Starting....."
  157. chkconfig httpd on
  158. service httpd restart


  159. fi


  160. ###########Install ZendOptimer########################
  161.  if grep "ZendOptimizer.so" /etc/php.ini;then
  162.     echo -e "The PHP.ini has ZendOptimizer.so...."
  163.     continue;
  164.  else
  165. wget http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
  166. mkdir -pv /usr/local/php/extension
  167. tar xvf ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
  168. cp ZendOptimizer-3.3.9-linux-glibc23-x86_64/data/5_2_x_comp/ZendOptimizer.so /usr/local/php/extension/
  169. cat >>/etc/php.ini<<EOF
  170. [Zend]
  171. zend_extension = "/usr/local/php/extension/ZendOptimizer.so"
  172. EOF
  173.  fi


  174. echo -e "The Mysql Server Starting....."
  175. chkconfig mysqld on
  176. service mysqld restart


  177. echo -e "
  178.         The Apache 2.22 Install Successfull....
  179.         The Mysql 5.1.13 Install Sucessfull....
  180.         The PHP 5.2.11 Install Successfull...
  181. "


  182. ######################################################
  183. ;;
  184. *)
  185.    echo -e "The Shell exit ....."
  186. ;;
  187. esac



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