Linux LNMP automatic installation script

Source: Internet
Author: User
Tags phpmyadmin zend

#!/bin/bash
Soft_dir= "/home/soft"
Config_dir= "/home/config"
Httpd= "httpd-2.0.52"
Mysql= "mysql-5.1.56"
php= "php-5.2.17"
Phpmyadmin= "phpMyAdmin-2.9.0.2"
Zend= "Zendoptimizer-3.2.6-linux-glibc21-i386"
Echo-n "Check packages,please wait ... "
Cat > List << EOF &&
Httpd-2.0.52.tar.gz
Mysql-5.1.56.tar.gz
Freetds-0.64.tar.gz
Freetype-2.1.10.tar.gz
Gd-2.0.33.tar.gz
Jpegsrc.v6b.tar.gz
Libmcrypt-2.5.7.tar.gz
Libpng-1.2.16.tar.gz
Libxml2-2.6.27.tar.gz
Php-5.2.17.tar.gz
PhpMyAdmin292.tar.gz
Zendoptimizer-3.2.6-linux-glibc21-i386.tar.gz
Zlib-1.2.3.tar.gz
Eof
For i in ' Cat list '
Do
If [-S $soft _dir/$i]; Then
echo "$i [found]"
Else
echo "Error: $i not Found!!!"
Fi
Done
echo "Auto Install Apache"
Groupadd Apache
Useradd-g apache-d/usr/local/apache-s/sbin/nologin Apache
CD ${soft_dir}
Tar zxvf ${httpd}.tar.gz
CD ${HTTPD}
./configure--prefix=/usr/local/apache--datadir=/www--enable-mods=shared=all--enable-module=so--disable-info-- Enable-shared=max--enable-rule=shared_core
Make && make install
Sed-i "S/nobody/apache/g"/usr/local/apache/conf/httpd.conf
Sed-i "S/#-1/apache/g"/usr/local/apache/conf/httpd.conf
Chown-r Apache.apache/usr/local/apache
Sed-e "/4/a #chkconfig: 2345"-i/usr/local/apache/bin/apachectl
Sed-e "/5/a #description: activates/deactivates Apache Web Server"-i/usr/local/apache/bin/apachectl
cd/etc/rc.d/init.d/
Cp/usr/local/apache/bin/apachectl httpd
chmod 755 httpd
Chkconfig--add httpd
Chkconfig--level httpd on
Service httpd Start
echo "Auto Install MySQL"
Groupadd MySQL
Useradd-g mysql-d/mysql-s/sbin/nologin MySQL
Mkdir-p/mysql/tmp
Chown-r Mysql.mysql/mysql
Chown-r Mysql.mysql/data
Chmod-r 777/mysql/
Chmod-r 777/data/
CD ${soft_dir}
Tar zxvf ${mysql}.tar.gz
CD $mysql
./configure--prefix=/mysql--localstatedir=/data--with-client-ldflags=-all-static--with-mysqld-ldflags=- All-static--with-mysqld-user=mysql--enable-assembler--with-extra-charsets=all--with-unix-socket-path=/mysql/ Tmp/mysql.sock
Make && make install
CP SUPPORT-FILES/MY-HUGE.CNF/ETC/MY.CNF
scripts/mysql_install_db--user=mysql
Chown-r Mysql.mysql/mysql
Chown-r Mysql.mysql/data
Chmod-r 777/mysql
Chmod-r 777/data
cd/mysql/
Share/mysql/mysql.server start
bin/mysqladmin-u root Password "Bcmedia"
cd/etc/rc.d/init.d/
Cp/home/soft/mysql-5.1.56/support-files/mysql.server mysqld
chmod 755 mysqld
Chkconfig--add mysqld
Chkconfig--level mysqld on
Service mysqld Start
Ln-s/mysql/bin/mysql/sbin/mysql
echo "Auto Install GD libary"
Mkdir-p/usr/local/jpeg6
Mkdir-p/usr/local/jpeg6/bin
Mkdir-p/usr/local/jpeg6/lib
Mkdir-p/usr/local/jpeg6/include
Mkdir-p/usr/local/jpeg6/man
Mkdir-p/usr/local/jpeg6/man/man1
CD ${soft_dir}
Tar zxvf libxml2-2.6.27.tar.gz
CD libxml2-2.6.27
./configure--PREFIX=/USR/LOCAL/LIBXML2
Make && make install
CD ${soft_dir}
Tar zxvf zlib-1.2.3.tar.gz
./configure--prefix=/usr/local/zlib
Make && make install
CD ${soft_dir}
Tar zxvf jpegsrc.v6b.tar.gz
CD jpeg-6b/
./configure--prefix=/usr/local/jpeg6/--enable-shared--enable-static
Make && make install
CD ${soft_dir}
Tar zxvf libpng-1.2.16.tar.gz
CD libpng-1.2.16
./configure
Make && make install
Mkdir-p/usr/local/freetype
CD ${soft_dir}
Tar zxvf freetype-2.1.10.tar.gz
CD freetype-2.1.10
./configure--prefix=/usr/local/freetype
Make && make install
CD ${soft_dir}
Tar zxvf gd-2.0.33.tar.gz
CD gd-2.0.33
./configure--prefix=/usr/local/gd--with-jpeg=/usr/local/jpeg6/--with-png--with-zlib--with-freetype=/usr/local/ freetype/
Make && make install
CD ${soft_dir}
Tar zxvf freetds-0.64.tar.gz
CD freetds-0.64
./configure--prefix=/usr/local/freetds--with-tdsver=8.0--enable-msdblib--enable-dbmfix--with-gnu-ld
Make && make install
echo "Auto Install PHP"
CD ${soft_dir}
Tar zxvf ${php}.tar.gz
CD ${php}
./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache/bin/apxs--enable-sockets--with-mysql=/mysql-- With-mssql=/usr/local/freetds--with-gd=/usr/local/gd--with-jpeg-dir=/usr/local/jpeg6--with-freetype-dir=/usr/ Local/freetype--with-zlib--with-png--enable-gd-native-ttf--enable-magic-quotes--with-iconv--with-mbstring-- Enable-track-vars--enable-force-cgi-redirect--enable-calendar--with-gettext--with-gdbm--with-ttf-- With-extra-charsets_complex--with-msdblib--enable-module=dso--with-versioning--enable-libxml--enable-so
Make && make install
CP Php.ini-dist/usr/local/php/lib/php.ini
echo "/mysql/lib/usr/local/php/modules/freetds/lib" >>/etc/ld.so.conf
Ldconfig
CD ${config_dir}
Yes | CP httpd.conf/usr/local/apache/conf/httpd.conf
Yes | CP Php.ini/usr/local/php/lib/php.ini
echo "Install phpMyAdmin"
Mkdir-p/www/htdocs/phpmyadmin
Cd/www/htdocs
RM-RF *
CD ${soft_dir}
Tar zxvf phpMyAdmin292.tar.gz
CD ${phpmyadmin}
CP-RF */www/htdocs/phpmyadmin
CD ${config_dir}
Yes | CP config.default.php/www/htdocs/phpmyadmin/libraries/config.default.php
Yes | CP select_lang.lib.php/www/htdocs/phpmyadmin/libraries/select_lang.lib.php
/ETC/INIT.D/HTTPD restart
echo "Auto Install Zend"
Cd/home/soft
Tar zxvf ${zend}.tar.gz
CD ${zend}
./install.sh

Linux LNMP automatic installation script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.