首页 电脑 电脑学堂 查看内容

shell实现lamp自动安装

2011-5-26 10:59 697 0

摘要:   #!/bin/bash  yum install expect -y  IP=192.168.1.179  PASSWD=123456  content=$(cat <<!  spaw...
关键词: local usr install imap with php 2007 lamp client apache

  #!/bin/bash  yum install expect -y  IP=192.168.1.179  PASSWD=123456  content=$(cat <<!  spawn scp -r root@$IP:/home/CRM /home  send "yes "  expect password:  send "$PASSWD "  expect "Are you sure you want to continue connecting (yes/no)?" { send "yes " } "Password:" { send "$PASSWD " }  expect eof  )  echo "$content" | expect  ###install Compile Environment###  for i in gcc gcc-c++ flex bison autoconf automake bzip2-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel ; do yum install -y $i ;done  ###install GD2 libxml2 libmcrypt openssl###  mkdir /tmp/lamp  cd /home/CRM/LAMP  tar xvf gd-2.0.34.tar.gz -C /tmp/lamp  tar xvf libxml2-2.7.2.tar.gz -C /tmp/lamp  tar xvf libmcrypt-2.5.8.tar.bz2 -C /tmp/lamp  tar xvf openssl-0.9.8e.tar.gz -C /tmp/lamp  cd /tmp/lamp/gd-2.0.34  ./configure --prefix=/usr/local/gd2  make  make install  cd /tmp/lamp/libxml2-2.7.2  ./configure --prefix=/usr/local/libxml2  make  make install  cd /tmp/lamp/libmcrypt-2.5.8  ./configure --prefix=/usr/local/libmcrypt  make  make install  cd /tmp/lamp/openssl-0.9.8e  ./config --prefix=/usr/local/openssl  make  make install  ###install mysql###  cd /home/CRM/LAMP  tar xvf mysql-5.0.27.tar.gz -C /tmp/lamp  cd /tmp/lamp/mysql-5.0.27  ./configure \  "--prefix=/usr/local/mysql" \  "--localstatedir=/var/lib/mysql" \  "--with-mysqld-user=mysql" \  "--without-debug" \  "--with-big-tables" \  "--with-extra-charsets=all" \  "--with-pthread" \  "--enable-static" \  "--enable-thread-safe-client" \  "--with-client-ldflags=-all-static" \  "--with-mysqld-ldflags=-all-static" \  "--enable-assembler" \  "--without-isam" \  "--without-innodb" \  "--without-ndb-debug"  make  make install  useradd mysql  cd /usr/local/mysql  bin/mysql_install_db --user=mysql  chown -R root:mysql .  chown -R mysql /var/lib/mysql  cp share/mysql/my-huge.cnf /etc/my.cnf  cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld  chmod 755 /etc/rc.d/init.d/mysqld  chkconfig --add mysqld  chkconfig --level 3 mysqld on  /etc/rc.d/init.d/mysqld start  bin/mysqladmin -u root password 'Keqisoft1'  N=`cat -n /root/.bash_profile | grep 'PATH=$PATH:$HOME/bin' | awk '{print $1}'`  sed -i ''$N'a'PATH=$PATH:/usr/local/mysql/bin'' /root/.bash_profile  source /root/.bash_profile  service mysqld restart  ###install apache###  tar xvf /home/CRM/LAMP/httpd-2.2.9.tar.gz -C /tmp/lamp  cd /tmp/lamp/httpd-2.2.9  ./configure \  "--prefix=/usr/local/apache2" \  "--with-included-apr" \  "--enable-so" \  "--enable-deflate=shared" \  "--enable-expires=shared" \  "--enable-rewrite=shared" \  "--enable-static-support" \  "--disable-userdir"  make  make install  echo '/usr/local/apache2/bin/apachectl start ' >> /etc/rc.local  /usr/local/apache2/bin/apachectl start  ###install imap###  yum install openssl-devel -y  yum install libtool-ltdl-devel -y  yum install libtool -y  cd /home/CRM  /bin/tar zxf imap.tar.Z  cd /home/CRM/imap-2007e  make lr5 PASSWDTYPE=std SSLTYPE=unix.nopwd IP6=4  echo "set disable-plaintext nil" > /etc/c-client.cf  mkdir /usr/local/imap-2007e  mkdir /usr/local/imap-2007e/include/  mkdir /usr/local/imap-2007e/lib/  chmod -R 077 /usr/local/imap-2007e  rm -rf /usr/local/imap-2007e/include/*  rm -rf /usr/local/imap-2007e/lib/*  rm -rf /usr/sbin/imapd  cp imapd/imapd /usr/sbin/  cp c-client/*.h /usr/local/imap-2007e/include/  cp c-client/*.c /usr/local/imap-2007e/lib/  cp c-client/c-client.a /usr/local/imap-2007e/lib/libc-client.a  ###install curl###  tar xvf /home/CRM/curl-7.17.1.tar.gz -C /tmp/lamp  cd /tmp/lamp/curl-7.17.1  ./configure --prefix=/usr/local/curl  make  make install  ###install php###  tar xvf /home/CRM/LAMP/php-5.2.3.tar.bz2 -C /tmp/lamp  cd /tmp/lamp/php-5.2.3  ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/include/freetype2 --with-zlib --with-png-dir=usr/local/libpng12 --with-libxml-dir=/usr/local/libxml2 --with-gd --enable-ftp --enable-sockets -enable-mbstring=all- --with-mcrypt=/usr/local/libmcrypt --with-curl=/usr/local/curl \  --with-imap-ssl \  --with-imap=/usr/local/imap-2007e  make  make install  mkdir /usr/local/php/etc  cp php.ini-dist /usr/local/php/etc/php.ini  ###install Zend###  tar xvf /home/CRM/LAMP/ZendOptimizer-3.3.0a-linux-glibc21-i386.tar.gz -C /tmp/lamp  cd /tmp/lamp/ZendOptimizer-3.3.0a-linux-glibc21-i386  bash install.sh  ###configure lamp###  N=`cat -n /usr/local/apache2/conf/httpd.conf | grep 'AddType application/x-gzip .gz .tgz' | awk '{print $1}'`  sed -i ''$N'aAddType application/x-httpd-php .php' /usr/local/apache2/conf/httpd.conf  sed -i '/^    DirectoryIndex index.html/s/$/ index.php/' /usr/local/apache2/conf/httpd.conf  sed -i '/^disable_functions =/s/$/ phpinfo,passthru,exec,system,chroot,scandir,chgrp,chown,escapeshellcmd,escapeshellarg,shell_exec,proc_open,proc_get_status,error_log,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,leak,popepassthru,stream_socket_server/' /usr/local/php/etc/php.ini  ###configure start###  sed /usr/local/php/etc/php.ini -r -ibackup -f - <<END_SED_SCRIPT  s/^safe_mode *=.*/safe_mode = Off/;  s/^display_errors *=.*/display_errors = On/;  s/^file_uploads *=.*/file_uploads = On/;  s/^register_globals *=.*/register_globals = Off/;  s/^max_execution_time *=.*/max_execution_time = 600/;  s/^output_buffering *=.*/output_buffering= On/;  s/^memory_limit *=.*/memory_limit =64M/;  s/^error_reporting *=.*/error_reporting = E_WARNING \& \~E_NOTICE/;  s/^allow_call_time_pass_reference *=.*/allow_call_time_pass_reference = On/;  s/^log_errors *=.*/log_errors = Off/;  s/^short_open_tag *=.*/short_open_tag = On/;  END_SED_SCRIPT
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部