LAMP 2011

 

LAMP

 
  
  1. #yum -y install ntp vim wget 
  2. #yum -y install gcc make patch gcc-c++ gcc-g77 flex bison autoconf automake \ 
  3. libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel \ 
  4. zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel \ 
  5. curl curl-devel libtiff-devel fontconfig-devel libXpm-devel gettext-devel   pam-devel pcre-devel \ 
  6. libtool libtool-ltdl openssl openssl-devel libtool libtool-libs autoconf kernel-devel \ 
  7. libevent libevent-devel apr-devel apr-util 
  8. ####( GD2 LibXML2 LibMcrypt jpeg6 freetype zlib libpng) 
  9.  
  10. Mysql 
  11. #mkdir /var/lib/mysqldata 
  12. # groupadd mysql 
  13. # useradd -r -g mysql mysql 
  14. #chown -R mysql.mysql /var/lib/mysqldata 
  15. # wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz or yum install cmake cmake-gui 
  16. # tar zxvf cmake-2.8.5.tar.gz 
  17. # cd cmake-2.8.5 
  18. # ./configure 
  19. # make && make install 
  20. # wget http://mysql.stu.edu.tw/Downloads/MySQL-5.5/mysql-5.5.14.tar.gz 
  21. # tar zxvf mysql-5.5.14.tar.gz 
  22. # cd mysql-5.5.14.tar.gz 
  23. #md5sum mysql-5.5.14.tar.gz 
  24. #show options 
  25. #cmake . -LH or cmake . 
  26. # cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ 
  27. -DDEFAULT_CHARSET=utf8 \ 
  28. -DDEFAULT_COLLATION=utf8_general_ci \ 
  29. -DENABLE_DTRACE=1 \ 
  30. -DMYSQL_DATADIR=/var/lib/mysqldata \ 
  31. -DMYSQL_TCP_PORT=3306 \ 
  32. -DMYSQL_UNIX_ADDR=/var/lib/mysqldata/mysql.sock \ 
  33. -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \ 
  34. -DWITH_MYISAM_STORAGE_ENGINE=1 \ 
  35. -DWITH_INNOBASE_STORAGE_ENGINE=1 \ 
  36. -DWITH_MEMORY_STORAGE_ENGINE=1 \ 
  37. -DWITH_READLINE=1 \ 
  38. -DENABLED_LOCAL_INFILE=1 \ 
  39. -DMYSQL_USER=mysql \ 
  40. # make 
  41. # make install 
  42. #cd /usr/local/mysql 
  43. #chown -R mysql.mysql . 
  44. # cp support-files/my-medium.cnf /etc/my.cnf 
  45. # chmod 755 scripts/mysql_install_db 
  46. # scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/var/lib/mysqldata 
  47. # cp support-files/mysql.server /etc/init.d/mysql 
  48. # chmod 755 /etc/init.d/mysqld 
  49. # chkconfig mysql on 
  50. # export PATH=/usr/local/mysql/bin:$PATH 
  51. # alias mysql_start="mysqld_safe &" 
  52. # alias mysql_stop="mysqladmin –u root -p shutdown" 
  53. # /etc/init.d/mysqld start 
  54. # mysql -u root –p 
  55. # /usr/local/mysql/bin/mysqladmin -u root password 'new-password' 
  56. or # /usr/local/mysql/bin/mysqladmin -u root -h ‘hostname’ password 'new-password' 
  57.  
  58. http://www.cnblogs.com/yd1227/archive/2011/06/08/2074979.html 
  59.  
  60. http://www.libgd.org/releases/gd-2.0.35.tar.bz2 
  61. tar jxvf gd-2.0.35.tar.bz2 
  62. cd gd-2.0.35 
  63. ./configure --prefix=/usr/local/gd2 
  64. make && make install 
  65.  
  66. http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.12.tar.gz 
  67. tar zxvf libiconv-1.12.tar.gz 
  68. cd libiconv-1.12/ 
  69. ./configure --prefix=/usr/local 
  70. make 
  71. make install 
  72. cd ../ 
  73. ln -s /usr/local/lib/libiconv.so.2 /usr/lib/ 
  74.  
  75. http://mirror.optus.net/sourceforge/m/mc/mcrypt/libmcrypt-2.5.8.tar.gz 
  76. tar zxvf libmcrypt-2.5.8.tar.gz 
  77. cd libmcrypt-2.5.8/ 
  78. ./configure 
  79. make 
  80. make install 
  81. /sbin/ldconfig 
  82. cd libltdl/ 
  83. ./configure --enable-ltdl-install 
  84. make 
  85. make install 
  86. cd ../../ 
  87. cp /usr/local/lib/libmcrypt.* /usr/lib 
  88.  
  89. http://mirror.optus.net/sourceforge/m/mh/mhash/mhash-0.9.9.tar.gz 
  90. tar zxvf mhash-0.9.9.tar.gz 
  91. cd mhash-0.9.9/ 
  92. ./configure 
  93. make 
  94. make install 
  95. cd ../ 
  96. ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 
  97.  
  98. http://jaist.dl.sourceforge.net/sourceforge/mcrypt/mcrypt-2.6.7.tar.gz 
  99. tar zxvf mcrypt-2.6.7.tar.gz 
  100. cd mcrypt-2.6.7/ 
  101. ./configure 
  102. make 
  103. make install 
  104. cd ../ 
  105.  
  106.  
  107. http://opensource.nchc.org.tw/COSA/CNS4/cronolog-1.6.2.tar.gz 
  108.  
  109. tar xvf cronolog-1.6.2.tar.gz 
  110.  
  111. cd cronolog-1.6.2 
  112.  
  113. ./configure --prefix=/usr/local/cronolog 
  114.  
  115. make && make install 
  116.  
  117. cd .. 
  118.  
  119.  
  120. Apache 2 
  121. --prefix=/usr/local/apache2 \ 
  122. --with-mpm=worker \ 
  123. --enable-so \ 
  124. --enable-deflate=shared \ 
  125. --enable-expires=shared \ 
  126. --enable-rewrite=shared \ 
  127. --enable-ssl=shared 
  128. --enable-disk-cache 
  129. --enable-file-cache 
  130. --enable-mem-cache 
  131. --enable-headers 
  132. --enable-vhost_alias 
  133. --enable-static-support \ 
  134. --enable-static-htpasswd \ 
  135. --enable-static-htdigest \ 
  136. --enable-static-rotatelogs \ 
  137. --enable-static-logresolve \ 
  138. --enable-static-htdbm \ 
  139. --enable-static-ab \ 
  140. --enable-static-checkgid \       
  141.  
  142. PHP 
  143. # ./configure \   
  144. --prefix=/usr/local/php \   
  145. --with-apxs2=/usr/local/apache2/bin/apxs \   
  146. --with-config-file-path=/usr/local/php/etc" \   
  147. --with-mysql=/usr/local/mysql \   
  148. --with-libxml-dir=/usr/ \   
  149. --with-gd=/usr/local/gd2 \   
  150. --with-jpeg-dir \   
  151. --with-png-dir \   
  152. --with-bz2 \   
  153. --with-freetype-dir \   
  154. --with-iconv-dir=/usr/local \  
  155. --with-zlib-dir \   
  156. --with-openssl=/usr/local/openssl \  #### 
  157. --with-mcrypt=/usr/local/libmcrypt \   
  158. --enable-soap \   
  159. --enable-gd-native-ttf \   
  160. --enable-ftp \   
  161. --enable-mbstring \   
  162. --enable-exif \   
  163. --disable-ipv6 \   
  164. --disable-cgi \   
  165. --disable-cli 
  166.  
  167. mkdir -p /usr/local/php/etc 
  168. cp php.ini-dist /usr/local/php/etc/php.ini 
  169. cd ../ 
  170.  
  171. # php extensions 
  172. sed -i 's#output_buffering = Off#output_buffering = On#' /usr/local/php/etc/php.ini 
  173. sed -i 's/post_max_size = 8M/post_max_size = 50M/g' /usr/local/php/etc/php.ini 
  174. sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /usr/local/php/etc/php.ini 
  175. sed -i 's/;date.timezone =/date.timezone = PRC/g' /usr/local/php/etc/php.ini 
  176.  
  177.  
  178. groupadd www 
  179. useradd -g www www 
  180. mkdir -p /var/www/html 
  181. chmod +w /var/www/html 
  182. chown -R www:www /var/www/html 
  183.  
  184. apache php 
  185. # vi /usr/local/apache2/conf/httpd.conf 
  186. LoadModule php5_module modules/libphp5.so 
  187. AddType application/x-gzip .gz .tgz 
  188. AddType application/x-httpd-php .php  
  189. DirectoryIndex index.html index.htm index.php 
  190. Include conf/extra/httpd-mpm.conf   
  191. Include conf/extra/httpd-info.conf  
  192. Include conf/extra/httpd-vhosts.conf  
  193. Include conf/extra/httpd-default.conf 
  194.  
  195.  
  196. mv /usr/local/apache2/conf/extra/httpd-vhosts.conf /usr/local/apache2/conf/extra/httpd-vhosts.conf.save 
  197. mv /usr/local/apache2/conf/extra/httpd-default.conf /usr/local/apache2/conf/extra/httpd-default.conf.save 
  198. mv /usr/local/apache2/conf/extra/httpd-mpm.conf /usr/local/apache2/conf/extra/httpd-mpm.conf.save 
  199.  
  200.  
  201. vi /usr/local/apache2/conf/extra/httpd-vhosts.conf 
  202.     NameVirtualHost *:80 
  203.  
  204.     <VirtualHost *:80> 
  205.         ServerAdmin shake.chen@gmail.com 
  206.         DocumentRoot "/data/www/wwwroot/test.com" 
  207.         ServerName test.com 
  208.         ServerAlias bbs.test.com 
  209.         ErrorLog "logs/test.com-error_log" 
  210.         CustomLog "|/usr/local/cronolog/sbin/cronolog /data/logs/access_www.test.com.%Y%m%d" combined 
  211.     </VirtualHost> 
  212.  
  213.     <VirtualHost *:80> 
  214.         ServerAdmin shake.chen@gmail.com 
  215.         DocumentRoot "/data/www/wwwroot/linux.com" 
  216.         ServerName linux.com 
  217.         ServerAlias bbs.linux.com 
  218.         ErrorLog "logs/linux.com-error_log" 
  219.         CustomLog "|/usr/local/cronolog/sbin/cronolog /data/logs/access_www.linux.com.%Y%m%d" combined 
  220.     </VirtualHost> 
  221.  
  222.  
  223. vi /usr/local/apache2/conf/extra/httpd-default.conf 
  224.     Timeout 15 
  225.     KeepAlive Off 
  226.     MaxKeepAliveRequests 50 
  227.     KeepAliveTimeout 5 
  228.     UseCanonicalName Off 
  229.     AccessFileName .htaccess 
  230.     ServerTokens Prod 
  231.     ServerSignature Off 
  232.     HostnameLookups Off 
  233.  
  234.  
  235.     vi /usr/local/apache2/conf/extra/httpd-mpm.conf 
  236.     <IfModule mpm_prefork_module> 
  237.         ServerLimit         2000 
  238.         StartServers          10 
  239.         MinSpareServers       10 
  240.         MaxSpareServers      15 
  241.         MaxClients          2000 
  242.         MaxRequestsPerChild   10000 
  243.     </IfModule> 
  244.  
  245. echo "/usr/local/apache-2.2.15/bin/apachectl start"  >> /etc/rc.local 
  246.  
  247. http://www.iuscommunity.org/Repos 
  248. http://os.51cto.com/art/201103/248258.htm 
  249. http://os.51cto.com/art/201103/250276.htm 
  250. http://os.51cto.com/art/201103/247916.htm 
  251. http://whxhz.iteye.com/blog/1084586 
  252. http://bbs.chinaunix.net/viewthread.php?tid=1268156 
  253. http://tuxlite.com/ 
  254. http://myhat.blog.51cto.com/391263/599316 
  255. http://liujiesmart.iteye.com/blog/636151 
  256. http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-centos-5.6-lamp 
  257.