jdk + mysql + nginx + resin step installation script

2010-11-09  来源:本站原创  分类:OS  人气:67 

#! / Bin / bash
# Author: duanyunxi
# Version: v2.0

touch / var / installserver.tmp

# # # # Begin preparations
echo "# # start preparatory work! # #"
if [-f / var / installserver.tmp]; then
RETVAL = `grep 'ready' / var / installserver.tmp`
if ["$ RETVAL" == ""]; then
echo "# # to confirm server_2.0 path! # #"
echo "Please enter server_2.0 location, for example: / home/server_2.0.tar.gz"
INPUT = "n"
until ["$ INPUT" == "Y"] | | ["$ INPUT" == "y"]
do
read SERVERPATH
echo "You entered server_2.0 location is: $ SERVERPATH, please confirm (y | n)?"
read INPUT
if ["$ INPUT"! = "Y"] & & ["$ INPUT"! = "y"]; then
echo "Make sure server_2.0 location, re-enter:"
else
echo "server_2.0 location is: $ SERVERPATH"
fi
done
echo "# # extract server_2.0! # #"
cd / home
cp $ SERVERPATH / home/server_2.0.tar.gz
tar xzf server_2.0.tar.gz
chmod 755-R server_2.0
echo "ready ok!">> / var / installserver.tmp
echo "preparatory work has been completed!"
sleep 10
else
echo "preparation work has been done!"
fi
fi

# # To install JDK # #
echo "# # to install JDK! # #"
if [-f / var / installserver.tmp]; then
RETVAL = `cat / var / installserver.tmp | grep 'jdk' | grep 'successfully'`
if ["$ RETVAL" == ""]; then
cd / home/server_2.0
chmod u + x ./jdk-6u19-linux-i586.bin
./jdk-6u19-linux-i586.bin
mv jdk1.6.0_19 / usr / local / jdk
ln-s / usr / local / jdk / bin / java / usr / bin / java
ln-s / usr / local / jdk / bin / javac / usr / bin / javac
ln-s / usr / local / jdk / jre / usr / local / jre
echo "jdk has installed successfully!">> / var / installserver.tmp
echo "JDK installation is complete!"
sleep 10
else
echo "JDK already installed it!"
fi
fi

# # Begin configuring JDK environment variables # #
echo "# # start configuring JDK environment variable! # #"
if [-f / var / installserver.tmp]; then
RETVAL = `cat / etc / profile | grep 'JAVA_HOME'`
if ["$ RETVAL" == ""]; then
echo "">> / etc / profile
echo 'JAVA_HOME = / usr / local / jdk'>> / etc / profile
echo 'JRE_HOME = / usr / local / jre'>> / etc / profile
echo 'PATH = $ PATH: $ JAVA_HOME / bin: $ JRE_HOME / bin'>> / etc / profile
echo 'CLASSPATH =.: $ JAVA_HOME / lib / dt.jar: $ JAVA_HOME / lib / tools.jar: $ JRE_HOME / lib:'>> / etc / profile
echo 'export JAVA_HOME JRE_HOME PATH CLASSPATH'>> / etc / profile
source / etc / profile
echo "JDK environment variable configuration is complete!"
else
echo "JDK environment variable is already configured it!"
fi
java-version
fi

# # Start the installation resin # #
echo "# # start the installation resin! # #"
if [-f / var / installserver.tmp]; then
RETVAL = `cat / var / installserver.tmp | grep 'resin' | grep 'successfully'`
if ["$ RETVAL" == ""]; then

##### Duanyunxi-2010-10-28
INPUT = "n"
until ["$ INPUT" == "Y"] | | ["$ INPUT" == "y"]
do
PORT = ""
echo "Please enter the port number of resin? (8000-8999)"
read PORT
if [$ {PORT}-lt 8000] | | [$ {PORT}-gt 8999]; then
echo "enter the port number is out of range, re-enter:"
read PORT
fi
echo "Your input number is: $ PORT, please confirm (y | n)?"

read INPUT
if ["$ INPUT"! = "Y"] & & ["$ INPUT"! = "y"]; then
echo "Make sure that port, re-enter:"
else
echo "RESIN_PORT = $ PORT">> / var / installserver.tmp
echo "port: $ PORT"
fi
done

cd / home/server_2.0
tar-zxvf resin-pro-3.1.10.tar.gz
cd resin-pro-3.1.10
. / Configure - prefix = / usr / local / resin - enable-jni
sleep 10
make
sleep 10
make install
sleep 10

RETVAL = `cat / etc / profile | grep 'RESIN_HOME'`
if ["$ RETVAL" == ""]; then
echo "">> / etc / profile
echo 'RESIN_HOME = / usr / local / resin'>> / etc / profile
echo 'export RESIN_HOME'>> / etc / profile
source / etc / profile
echo "resin environment variable configuration is complete!"
fi

# # Duanyunxi
sed-i-e "s @ 8080 @ $ PORT @" / usr / local / resin / conf / resin.conf

cp / home/server_2.0/resin.init / etc / init.d / resin
chmod + x / etc / init.d / resin

chkconfig - del resin & & chkconfig - add resin
chkconfig resin on
echo "resin has installed successfully!">> / var / installserver.tmp
echo "resin installation is complete!"
sleep 10
else
echo "resin already be installed!"
fi
fi

# # To install nginx # #
echo "# # to install nginx! # #"
if [-f / var / installserver.tmp]; then
RETVAL = `cat / var / installserver.tmp | grep 'nginx' | grep 'successfully'`
if ["$ RETVAL" == ""]; then

cd / home/server_2.0
tar-zxvf pcre-7.8.tar.gz
tar-zxvf zlib-1.2.2.tar.gz
tar zxvf openssl-0.9.8k.tar.gz
tar zxvf nginx-0.8.38.tar.gz
cd nginx-0.8.38 /
. / Configure - prefix = / usr / local / nginx - with-pcre = / home/server_2.0/pcre-7.8 - with-zlib = / home/server_2.0/zlib-1.2.2 - with -openssl = / home/server_2.0/openssl-0.9.8k \
- With-http_ssl_module - with-http_realip_module - with-http_flv_module - with-http_gzip_static_module - with-http_stub_status_module
sleep 10
make
sleep 10
make install
sleep 10

cp / home/server_2.0/nginx.init / etc / init.d / nginx
chmod + x / etc / init.d / nginx
chkconfig - del nginx & & chkconfig - add nginx
chkconfig nginx on

echo "nginx has installed successfully!">> / var / installserver.tmp
echo "nginx installation is complete!"
else
echo "nginx already be installed!"
sleep 10
fi
fi

# # To install mysql # #
echo "# # start the installation mysql! # #"
if [-f / var / installserver.tmp]; then
RETVAL = `cat / var / installserver.tmp | grep 'mysql' | grep 'successfully'`
if ["$ RETVAL" == ""]; then
INPUT = "n"
until ["$ INPUT" == "Y"] | | ["$ INPUT" == "y"]
do
ENCODE = ""
echo "Please select the mysql encoding (g: gbk | u: utf8)?"
read ENCODE
if ["$ ENCODE" == "G"] | | ["$ ENCODE" == "g"]; then
echo "Your choice of encoding is gbk, please confirm (y | n)?"
ENCODE = "gbk"
elif ["$ ENCODE" == "U"] | | ["$ ENCODE" == "u"]; then
echo "Your choice of encoding is utf8, please confirm (y | n)?"
ENCODE = "utf8"
fi

read INPUT
if ["$ INPUT"! = "Y"] & & ["$ INPUT"! = "y"]; then
echo "Please confirm, re-enter:"
else
echo "MYSQL_ENCODE = $ ENCODE">> / var / installserver.tmp
echo "mysql encoding is: $ ENCODE"
fi
done

##### Duanyunxi-2010-10-28

INPUT = "n"
until ["$ INPUT" == "Y"] | | ["$ INPUT" == "y"]
do
PORT = ""
echo "Enter the mysql port number? (8000-8999)"
read PORT
if [$ {PORT}-lt 8000] | | [$ {PORT}-gt 8999]; then
echo "enter the port number is out of range, re-enter:"
read PORT
fi
echo "Your input number is: $ PORT, please confirm (y | n)?"

read INPUT
if ["$ INPUT"! = "Y"] & & ["$ INPUT"! = "y"]; then
echo "Make sure that port, re-enter:"
else
echo "MYSQL_PORT = $ PORT">> / var / installserver.tmp
echo "port: $ PORT"
fi
done

INPUT = "n"
until ["$ INPUT" == "Y"] | | ["$ INPUT" == "y"]
do
DATAPATH = ""
echo "Please enter the data storage location, for example: / var / data"
read DATAPATH
echo "You enter the data storage location is: $ DATAPATH, please confirm (y | n)?"

read INPUT
if ["$ INPUT"! = "Y"] & & ["$ INPUT"! = "y"]; then
echo "Make sure that the data storage location, re-enter:"
else
echo "DATA_PATH = $ DATAPATH">> / var / installserver.tmp
echo "data storage location: $ DATAPATH"
fi
done

INPUT = "n"
until ["$ INPUT" == "Y"] | | ["$ INPUT" == "y"]
do
PASSWORD = ""
echo "Enter the mysql root user password for the administrator?"
read PASSWORD
echo "your password is: $ PASSWORD, please confirm (y | n)?"

read INPUT
if ["$ INPUT"! = "Y"] & & ["$ INPUT"! = "y"]; then
echo "Please verify the password, re-enter:"
else
echo "password: $ PASSWORD"
fi
done

rm-rf / etc / my.cnf
groupadd mysql
useradd-g mysql mysql
cd / home/server_2.0
tar-zxvf mysql-5.1.45.tar.gz
cd mysql-5.1.45

. / Configure - prefix = / usr / local / mysql - with-mysqld-ldflags =- all-static - with-client-ldflags =- all-static - enable-assembler - with-extra-charsets = gb2312, big5, utf8, binary, ascii - enable-thread-safe-client - with-unix-socket-path = / usr / local / mysql / tmp / mysql.sock
sleep 10
make
sleep 10
make install
sleep 10
cp support-files/my-medium.cnf / etc / my.cnf
RETVAL = `cat / etc / my.cnf | grep 'default-character-set'`
if ["$ RETVAL" == ""]; then
sed-i-e "s @ \ [client \] @ \ [client \] \ ndefault-character-set = $ ENCODE @" / etc / my.cnf
sed-i-e "s @ \ [mysqld \] @ \ [mysqld \] \ ndefault-character-set = $ ENCODE @" / etc / my.cnf
fi

# # Duanyunxi
sed-i-e "s @ 3306 @ $ PORT @" / etc / my.cnf

cp support-files/mysql.server / etc / init.d / mysql
chmod + x / etc / init.d / mysql

# # # Duanyunxi
sed-i-e "40,50 s @ basedir = @ basedir = / usr / local / mysql @" / etc / init.d / mysql
sed-i-e "40,50 s @ datadir = @ datadir = $ DATAPATH @" / etc / init.d / mysql

chkconfig - del mysql & & chkconfig - add mysql
chkconfig mysql on

cd / usr / local / mysql
bin / mysql_install_db - user = mysql - datadir = $ DATAPATH

chown-R root.
chown-R mysql var
chgrp-R mysql.
service mysql start

rm-rf / usr / bin / mysql
ln-s / usr / local / mysql / bin / mysql / usr / bin / mysql
ln-s / usr / local / mysql / bin / mysqladmin / usr / bin / mysqladmin

# # # # Duanyunxi
ln-s / usr / local / mysql / bin / mysqldump / usr / bin / mysqldump

mysqladmin-u root password "$ PASSWORD"
mysqladmin-h localhost-u root password "$ PASSWORD"
mysqladmin-uroot-p $ PASSWORD version 1> / dev / null 2> & 1
RETVAL = $?
if [$ RETVAL-eq 0]; then
echo "mysql has installed successfully!">> / var / installserver.tmp
echo "mysql installation is complete!"
fi

touch / var / mysql.sql
echo "SET NAMES utf8;">> / var / mysql.sql
echo "USE \` mysql \ `;">> / var / mysql.sql
echo "INSERT INTO \` user \ `VALUES ('%',' root ', PASSWORD (' $ PASSWORD '),' Y ',' Y ',' Y ',' Y ',' Y ',' Y ' , 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', ' Y ',' Y ',' Y ',' N ',' N ',' N ',' N ',' N','','','','', 0,0,0,0 ); ">> / var / mysql.sql
mysql-uroot-p $ PASSWORD mysql </ var / mysql.sql
rm-rf / var / mysql.sql

service mysql stop
sleep 10
else
echo "mysql already installed it!"
fi
fi

# # # Firewall # #
# Echo "# # set firewall! # #"
# If [-f / var / installserver.tmp]; then
# RETVAL = `cat / etc/sysconfig/SuSEfirewall2 | grep 'FW_SERVICES_EXT_TCP' | grep '80 8080 443 3306 '`
# If ["$ RETVAL" == ""]; then
# Sed-i-e "s @ FW_SERVICES_EXT_TCP = \" \ "@ FW_SERVICES_EXT_TCP = \" 80 8080 443 3306 \ "@" / etc/sysconfig/SuSEfirewall2
# Fi
#
# RETVAL = `cat / etc/sysconfig/SuSEfirewall2 | grep 'FW_SERVICES_EXT_UDP' | grep '177 '`
# If ["$ RETVAL" == ""]; then
# Sed-i-e "s @ FW_SERVICES_EXT_UDP = \" \ "@ FW_SERVICES_EXT_UDP = \" 177 \ "@" / etc/sysconfig/SuSEfirewall2
# Fi
# RcSuSEfirewall2 restart
# Echo "Firewall setup is complete!"
# Fi

###### Duanyunxi
# # Firewall # #
echo "# # set firewall! # #"
if [-f / var / installserver.tmp]; then
RETVAL = `cat / var / installserver.tmp | grep 'SuSEfirewall2' | grep 'successfully'`
if ["$ RETVAL" == ""]; then
INPUT = "n"
until ["$ INPUT" == "Y"] | | ["$ INPUT" == "y"]
do
PORTS = ""
echo "Please enter the open resin, mysql port number? (* separated by spaces)"
read PORTS
echo "Your input number is: $ PORTS, please confirm (y | n)?"

read INPUT
if ["$ INPUT"! = "Y"] & & ["$ INPUT"! = "y"]; then
echo "Make sure that open port, re-enter:"
else
echo "SuSEfirewall2_PORTS = $ PORTS">> / var / installserver.tmp
echo "SuSEfirewall2 has set successfully!">> / var / installserver.tmp
echo "open resin, mysql port are: $ PORTS"
fi

sed-i-e "s @ FW_SERVICES_EXT_TCP = \" @ FW_SERVICES_EXT_TCP = \ "$ PORTS 80 22 443 @" / etc/sysconfig/SuSEfirewall2
sed-i-e "s @ FW_SERVICES_EXT_UDP = \" \ "@ FW_SERVICES_EXT_UDP = \" 177 \ "@" / etc/sysconfig/SuSEfirewall2
done
rcSuSEfirewall2 restart
echo "Firewall setup is complete!"
fi
fi

echo "service resin (start | stop | restart)"
echo "service nginx (start | stop | restart)"
echo "service mysql (start | stop | restart | status)"

相关文章
  • jdk + mysql + nginx + resin step installation script 2010-11-09

    #! / Bin / bash # Author: duanyunxi # Version: v2.0 touch / var / installserver.tmp # # # # Begin preparations echo "# # start preparatory work! # #" if [-f / var / installserver.tmp]; then RETVAL = `grep 'ready' / var / installserver.tmp` if [&

  • jdk + mysql + nginx + resin step in the installation script 2010-11-09

    #! / Bin / bash # Author: duanyunxi # Version: v2.0 touch / var / installserver.tmp Begin preparations for # # # # echo "# # start preparations! # #" if [-f / var / installserver.tmp]; then RETVAL = `grep 'ready' / var / installserver.tmp` if [&

  • linux software installation (jdk, mysql, tomcat) 2010-04-03

    linux software installation (jdk, mysql, tomcat) (2009-06-26 21:11:21) Run the installation file / Etc / profile configuration file JAVA_HOME =/... - directory file. PATH = $ PATH: $ JAVA_HOME / bin; ClASSPATH =.: $ JAVA_HOME / lib / dt.jar: $ JAVA_H

  • httpd-2.2.21 + php-5.3.8 installation script automatically 2011-09-22

    httpd-2.2.21 + php-5.3.8 installation script automatically http://netkiller.github.com/ #!/bin/bash #================================================================================ # LAMP Installing script by Neo <[email protected]> # http://netkill

  • TOMCAT + APACHE + JDK + MYSQL 2009-03-04

    Jdk1.6 + Tomcat6 + Apache2 + MySql5 installed (Windows version) Keywords: Jdk1.6 Tomcat6 Apache2 Mysql5 jk_mod.so Jdk1.6 + Tomcat6 + Apache2 + MySql5 installed (Windows version) Software download: 1, j2se jdk1.6 http://java.sun.com/javase/downloads/i

  • linux rathat5 step installation mysql5.1 2010-12-20

    1 install linux 2 Installing mysql, download the binary installation I experience more appropriate to extract the Installation http://mysql.cdpa.nsysu.edu.tw/Downloads/MySQL-5.1/mysql-5.1.54-linux-i686-glibc23.tar.gz 3 will be extracted after mysql-5

  • nagios + LAMP installation script automatically 2010-02-28

    #! / Bin / sh # Nagios V3.03 install script # Write by zhengyp # Date :2008-10-8 # Softwares are all store in / usr / local / src cd / usr / local / src # Install LAMP for Nagios # Step 1. Install Apache tar zxvf httpd-2.2.9.tar.gz cd httpd-2.2.9 . /

  • mysql sphinx storage engine installation 2010-05-29

    As business needs, need to install in existing mysql sphinx storage engine, to ensure that mysql is running under the existing completion. indeed support the storage engine mysql online hot swappable, installation steps described below: 1, view the c

  • Use of InstallAnywhere 2009 Integrated jdk mysql tomcat to EXE 2010-06-08

    1. Write two batch files: install.bat and uninstall.bat, on the service directory. install.bat content: set JAVA_HOME=%1%\jdk1.6.0_10 set CATALINA_HOME=%1%\tomcat6.0.26 call %1%\tomcat6.0.26\bin\service install Tomcat call %1%\mysql5.0.22\bin\mysqld

  • (Transfer) nginx + resin session problem-solving 2010-06-21

    A few days ago to see http://code.google.com have nginx_upstream_jvm_route project, read the introduction, very excited, because it is written by a Chinese patch to address the session of sync problem, but he is not shared, nor is it synchronization,

  • CentOS / linux under MySql 5.0.x installation. Optimization and security settings 2010-07-18

    Original Address: http://blog.chinaunix.net/u2/82530/showart_1956918.html Download page: http://dev.mysql .com/downloads/mysql/5.0.html # downloads To the bottom of the page to find the Source downloads, this is the source version, download the first

  • In linux installed on the system tomcat, jdk, mysql 2010-08-25

    jdk-6u21-linux-i586-rpm.bin (JDK) apache-tomcat-6.0.29.tar.gz (Tomcat install program) Java SDK installation steps: First implementation # Chmod a + x jdk-6u21-linux-i586-rpm.bin #. / Jdk-6u21-linux-i586-rpm.bin # Rpm-ivh jdk-6u21-linux-i586-rpm In /

  • Linux under nginx, resin, squid, lighttpd related 2009-09-02

    Questions in mind: nginx, resin, squid, lighttpd between these four, there is no direct correlation; put together just like to summarize my personal knowledge of your own but do not he intended! 1 Nginx: http://nginx.net/ General, we use Apache; non-

  • Reprinted: Xp under the Apache + PHP + MySQL + Zend Optimizer + phpMyAdmin Installation and Configuration 2010-05-19

    Xp under the Apache + PHP + MySQL + Zend Optimizer + phpMyAdmin Installation and Configuration <br /> Published :2009-07-25 23:55:12 Views: 897 Posted: superadmin set the font medium and small] [ http://www.tzlink.com/info/show.php?aid=9420 First, t

  • Nginx and Passenger installation for Ubuntu Server 2010-08-15

    Environment: Ubuntu Server 10.4 1. Install passenger sudo gem install passenger 2. Through the passenger install and configure nginx, nginx default will install to / opt / nginx under sudo passenger-install-nginx-module 3. Nginx startup script 1. To

  • MySQL on Windows, free installation and configuration 2010-10-31

    1, the software is downloaded to the official website mysql MySQL decompression package, mysql-noinstall-5.0.22-win32.zip Then extract to C: \ mysql MySQL database, which is the entire contents. 2, the configuration First we look at MySQL's root dire

  • Nginx + resin tuning document 2010-11-18

    http://blog.liuts.com/post/204/ Why not choose Apache / mod + resin? The model has been used before, mod_caucho exposure source bug has not been completely resolved. So switch to the Nginx + resin platform. Hardware required in addition to the memory

  • (Transfer) mysql windows7X64-bit operating system installation 2010-12-03

    Original Post Address: http://hi.baidu.com/linyg/blog/item/4e24253f533f59e154e72300.html mysql windows7X64-bit operating system installation Exchange please visit my website for more http://www.lpbiz.com exchange mysql-noinstall-5.1.47-winx64 configu

  • (Transfer) OpenSuse install jdk \ mysql \ tomcat \ nginx \ mysql-proxy 2010-04-07

    1. Install jdk a. go to http://java.sun.com download jdk (j2se) 1.6.0_19.bin b. # chkmod 777. / jdkxxx.bin c. #. / jdkxxx.bin d. # vi / etc / profile Finally add in the file: (if installed in / usr / local / jdk directory) export JAVA_HOME = / usr /

  • Ubuntu under jdk, mysql, tomcat installation and configuration 2010-11-14

    A, jdk installation 1. Download and install sun jdk First, http://java.sun.com download jdk-6u20-linux-i586.bin 2. To authorize the downloaded file and move to the specified folder Code: $ Sudo chmod u + x jdk-6u20-linux-i586.bin 3. Executable file t