Construction of JDK+TOMCAT+MYSQL Environment under Ubuntu

Source: Internet
Author: User
Tags mysql client unpack filezilla

Linux Environment modification catalina.sh
Add the following line to the "echo" Using catalina_base: $CATALINA _base "":
java_opts= "$JAVA _opts-server-xms800m-xmx800m-xx:maxnewsize=256m"

Set Server.xml

<connector port= "8080" protocol= "http/1.1"
maxthreads= "minsparethreads=" "maxsparethreads=" acceptcount= "700"
connectiontimeout= "20000" redirectport= "8443"/>

maxthreads= "600"///maximum number of threads
minsparethreads= "100"///number of threads created when initializing
maxsparethreads= "500"///Once you create a thread that exceeds this value, Tomcat shuts down and no longer needs
Socket thread.
Acceptcount= "700"//Specifies the number of requests that can be placed in the processing queue when all the threads that can be used to process the request are used, and requests that exceed this number will not be processed

-----------------------------------------------

JDK installed in the/usr/java directory, Tomcat installed in the/usr/local directory, if the directory does not exist will be created automatically, just put the JDK and Tomcat of the TAR package and script in the same directory, execute the script is done.

PS: This script can be executed repeatedly, and repeated execution automatically deletes the last installed JDK and Tomcat directory

?
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 #!/bin/shif [ -e /usr/java ];then    echo "delete old exist jdk ..."    sleep 2    rm -rf /usr/java    echo "install new jdk ..."    mkdir /usr/java    sleep 2    tar zxvf jdk* -C /usr/javaelse    mkdir /usr/java    tar zxvf jdk* -C /usr/javafi JDKPATH=`ls /usr/java`echo ${JDKPATH}echo " ">>/etc/profileecho "# JDK ENV">>/etc/profileecho "JAVA_HOME=/usr/java/${JDKPATH}">>/etc/profileecho ‘PATH=$JAVA_HOME/bin:$PATH‘>>/etc/profileecho ‘CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar‘>>/etc/profileecho ‘export JAVA_HOME‘>>/etc/profileecho ‘export PATH‘>>/etc/profileecho ‘export CLASSPATH‘>>/etc/profileif [ -e /usr/local/apache-tomcat* ];then    echo "delete old exist tomcat ..."    sleep 2    rm -rf /usr/local/apache-tomcat*    echo "install new tomcat ..."    sleep 2    tar zxvf apache-tomcat* -C /usr/localelse    tar zxvf apache-tomcat* -C /usr/localficd /usr/local/apache-tomcat*TOMCATPATH=`pwd`echo ${TOMCATPATH}echo " ">>/etc/profileecho "# TOMCAT ENV">>/etc/profileecho "TOMCAT_HOME=${TOMCATPATH}">>/etc/profileecho ‘PATH=$TOMCAT_HOME/bin:$PATH‘>>/etc/profile

Finally, in a little bit of execution

Source/etc/profile

Allow the environment variable to take effect.

---------------------------------------------

1, MySQL installation 1.1, installation

Due to the Apt-get default foreign software source, resulting in extremely slow download, I changed the source of software, with the domestic 163 software source.

Installation using Apt-get install, terminal input:

sudo apt-get install mysql-server

Tips:

Search Software: Apt-cache search software name keyword, support fuzzy query,

For example: Apt-cache search MySQL

During the installation process, there are two prompts to enter the password for the root account of MySQL, enter the password here, OK, until the installation is complete.

Note: After installation, if you need to see the location of MySQL installation, you can use the following Chitian.

whereis mysql
1.2. Create User

After Mysql has been installed, it is automatically started and is powered on from boot by default.

Terminal input:

Mysql–uroot–proot

Go to MySQL console. Create a User (username: wolfdog, Password: 123456), and authorize for remote access to MySQL (if required):

Grant all privileges on * * to [email protected] '% ' identified by ' 123456 ' with GRANT option;

Input:

Exit

Quit MySQL

Terminal input:

mysql–uwolfdog–p123456

Test whether the account you just created will log in to MySQL properly

1.3. Problems encountered (unable to remotely access MySQL client)

Terminal input:

sudo vi /etc/mysql/my.cnf

Open the/etc/mysql/my.cnf file and locate the following line:

Bind-address = 127.0.0.1

Comment out this line, or MYSQL remote may still be inaccessible.

Save and exit.

1.4. Several commands

Restart: Restart with service mode

service mysql restart

View MySQL Process

ps aux|grep mysql
2, installation JDK2.1, installation

Copy Local jdk-7u9-linux-i586.gz files to Ubuntu using Filezilla, and place them in the/usr/local directory (or in other directories)

Unpack the GZ Package

tar -zxvf jdk-7u9-linux-i586.gz

Generate directory after decompression: jdk1.7.0_09

Change Directory to Jdk7

sudo mv jdk1.7.0_09jdk7
2.2. Configure Environment variables

Use the VI command to open the/etc/profile file, terminal input:

sudo vi /etc/profile

Before the last line, add:

export JAVA_HOME=/usr/local/jdk7export JRE_HOME=/usr/local/jdk7/jreexport CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATHexport PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

Save and exit.

command to make the environment variable effective immediately:

source /etc/profile

To test whether the installation was successful:

Command Line input: java-version

3, installation tomcat3.1, installation

Copy Local apache-tomcat-7.0.32.tar.gz files to Ubuntu using FileZilla, and place them in the/usr/local directory (or in other directories)

Unpack the GZ Package

tar -zxvf apache-tomcat-7.0.32.tar.gz

Generate directory after decompression: apache-tomcat-7.0.32 Tomcat

Change Directory to Jdk7

sudo mv apache-tomcat-7.0.32tomcat
3.2. Configure Environment variables

Use the VI command to open the/etc/profile file, terminal input:

sudo vi /etc/profile

Before the last line, add:

Export Catalina_home=/usr/local/tomcat

Export path= $CATALINA _home/bin: $PATH

Save and exit.

Source/etc/profile let the environment variable take effect.

To start Tomcat:

startup.sh

3.3. Set up tomcat boot from boot

Use the VI command to open the/etc/init.d/tomcat file, terminal input:

sudo vi/etc/init.d/tomcat

This is a new file, enter the following :

Export JAVA_HOME=/USR/LOCAL/JDK7

[-f/usr/local/tomcat/bin/startup.sh] | | Exit 0 [-f/usr/local/tomcat/bin/shutdown.sh] | | Exit 0

Case "$" in

Start

Echo-n "Starting Tomcat:"

/usr/local/tomcat/bin/startup.sh

Retval=$?

Echo

[$RETVAL = 0] && touch/var/lock/tomcat;;

Stop

Echo-n "shutting down Tomcat:"

/usr/local/tomcat/bin/shutdown.sh

Retval=$?

Echo

[$RETVAL = 0] && rm-f/var/lock/tomcat;;

Restart

$ stop

$ start

;;

Condrestart)

[-e/var/lock/tomcat] && restart;

Status

$ stop

$ start

;;

Condrestart)

[-e/var/lock/tomcat] && restart;

Status

Status Tomcat

;;

*)

echo "Usage: $ {Start|stop|restart|status}"

Exit 1

Esac

Exit 0

Save and exit.

Modify permissions, let configuration take effect , terminal input:

sudo chmod 755/etc/init.d/tomcat

sudo update-rc.d Tomcat defaults 85

Construction of JDK+TOMCAT+MYSQL Environment under Ubuntu

Related Article

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.