一起学习linux之lamp脚本

lamp脚本: 

  
  
  
  
  1. mkdir /etc/yum.repos.d/backup 
  2.  mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/ 
  3.  mv /tmp/lamp/ftp.repo /etc/yum.repos.d/ 
  4.  yum clean all 
  5.  yum makecache 
  6.  yum -y install gcc gcc-c++ screen autoconf automake libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel pcre pcre-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libtiff libtiff-devel gettext gettext-devel pam pam-devel fontconfig-devel libXpm-devel libtool php-common 
  7. cd /tmp/lamp/ 
  8. tar -zxvf httpd-2.2.9.tar.gz 
  9. cd /tmp/lamp/httpd-2.2.9 
  10. ./configure --prefix=/usr/local/apache2/ --sysconfdir=/etc/httpd/ --with-included-apr --disable-userdir --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support 
  11.  make 
  12.  make install 
  13.  #/usr/local/apache2/bin/apachectl start 
  14.  #echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.local 
  15.  mv /tmp/lamp/httpd /etc/rc.d/init.d/httpd 
  16. #echo "/usr/local/apache2/bin/apachectl start">>/etc/rc.d/rc.local 
  17.  mv /tmp/lamp/httpd /etc/rc.d/init.d/httpd 
  18.  chmod +x /etc/rc.d/init.d/httpd 
  19.  chkconfig --add httpd 
  20.  chkconfig httpd on 
  21.  service httpd start 
  22.  #install mysql-server 
  23.  groupadd mysql 
  24.  useradd -g mysql mysql 
  25.  mkdir -p /data/mysql/var 
  26.  cd /tmp/lamp 
  27.  tar -zxvf Percona-Server-5.1.58.tar.gz 
  28.  cd /tmp/lamp/Percona-Server-5.1.58 
  29.  ./configure --prefix=/usr/local/mysql/ --localstatedir=/data/mysql/var --with-extra-charsets=utf8,gbk --with-pthread --enable-thread-safe-client --with-ssl --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --with-plugins=partition,innobase,csv,myisam,innodb_plugin --enable-shared --enable-assembler 
  30.  make && make install 
  31.  cp support-files/my-medium.cnf /etc/my.cnf 
  32.  cp support-files/mysql.server /etc/init.d/mysqld 
  33.  chmod +x /etc/init.d/mysqld 
  34.  ln -s /usr/local/mysql/bin/* /usr/local/bin/ 
  35.  ln -s /usr/local/mysql/lib/mysql/lib* /usr/lib/ 
  36. /usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql/var --user=mysql & 
  37.  chown -R root.mysql /usr/local/mysql/ 
  38.  #chown -R mysql.mysql /usr/local/mysql/var/ 
  39.  chown -R mysql.mysql /data/mysql/ 
  40.  sed -i '38a\basedir = /usr/local/mysql/ \' /etc/my.cnf 
  41.  sed -i '39a\datadir = /data/mysql/var/ \' /etc/my.cnf 
  42.  service mysqld start 
  43.  #install php 
  44.  cd /tmp/lamp 
  45.  tar -zxvf libmcrypt-2.5.8.tar.gz 
  46.  cd /tmp/lamp/libmcrypt-2.5.8/ 
  47.  ./configure --prefix=/usr/local/libmcrypt/ 
  48.  make 
  49.  make install 
  50.  cd /tmp/lamp/libmcrypt-2.5.8/libltdl 
  51.  ./configure --enable-ltdl-install 
  52.  make 
  53.  make install 
  54.  cd /tmp/lamp 
  55.  tar -zxvf libiconv-1.13.1.tar.gz 
  56. cd /tmp/lamp/libiconv-1.13.1 
  57.  ./configure --prefix=/usr/local/ 
  58.  make 
  59.  make install 
  60.  ln -s /usr/local/lib/libmcrypt* /usr/lib 
  61.  ln -s /usr/local/lib/libiconv.* /usr/lib 
  62.  ln -s /usr/local/lib/libiconv.* /usr/lib64/ 
  63.  yum -y install libxml2-devel curl-devel libpng-devel openldap-devel 
  64.  cd /tmp/lamp 
  65.  tar -zxvf php-5.2.6.tar.gz 
  66.  cd /tmp/lamp/php-5.2.6 
  67.  ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc/ 
  68.  --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-iconv-dir=/usr/local --with-libxml-dir --with-png-dir --with-jpeg-dir --with-freetype-dir --with-gd --with-zlib-dir --with-mcrypt=/usr/local/libmcrypt --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets 
  69.  make ZEND_EXTRA_LIBS='-liconv' 
  70.  make install 
  71.  ln -s /usr/local/php/bin/php /usr/bin/ 
  72.  cp php.ini-dist /usr/local/php/etc/php.ini 
  73. sed -i '170 s/DirectoryIndex/ DirectoryIndex index.php/' /etc/httpd/httpd.conf 
  74.  sed -i '312a\AddType application/x-httpd-php .php .phtml \' /etc/httpd/httpd.conf 
  75.  cd /tmp/lamp 
  76.  tar -zxvf PDO_MYSQL-1.0.2.tgz 
  77.  cd PDO_MYSQL-1.0.2 
  78.  /usr/local/php/bin/phpize 
  79.  ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql 
  80.  make && make install 
  81.  sed -i '486 s/extension_dir/ ;extension_dir/' /usr/local/php/etc/php.ini 
  82.  sed -i '597a extension = "pdo_mysql.so" ' /usr/local/php/etc/php.ini 
  83.  cp /tmp/lamp/index.php /usr/local/apache2/htdocs/index.php 
  84.  #/usr/local/apache2/bin/apachectl restart 
  85.  service httpd restart 

 

本文出自 “TNT、运维之路” 博客,谢绝转载!

你可能感兴趣的:(linux,lamp)