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/sh
if [ -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/java
else
mkdir /usr/java
tar zxvf jdk* -C
/usr/java
fi JDKPATH=`
ls /usr/java
`
echo ${JDKPATH}
echo " "
>>
/etc/profile
echo "# JDK ENV"
>>
/etc/profile
echo "JAVA_HOME=/usr/java/${JDKPATH}"
>>
/etc/profile
echo ‘PATH=$JAVA_HOME/bin:$PATH‘
>>
/etc/profile
echo ‘CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar‘
>>
/etc/profile
echo ‘export JAVA_HOME‘
>>
/etc/profile
echo ‘export PATH‘
>>
/etc/profile
echo ‘export CLASSPATH‘
>>
/etc/profile
if [ -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/local
else
tar zxvf apache-tomcat* -C
/usr/local
fi
cd /usr/local/apache-tomcat
*
TOMCATPATH=`
pwd
`
echo ${TOMCATPATH}
echo " "
>>
/etc/profile
echo "# TOMCAT ENV"
>>
/etc/profile
echo "TOMCAT_HOME=${TOMCATPATH}"
>>
/etc/profile
echo ‘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.
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
View MySQL Process
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
2.2. Configure Environment variables
Use the VI command to open the/etc/profile file, terminal input:
Before the last line, add:
export JAVA_HOME
=
/
usr
/
local
/
jdk7
export JRE_HOME
=
/
usr
/
local
/
jdk7
/
jre
export CLASSPATH
=
.:$JAVA_HOME
/
lib:$JRE_HOME
/
lib:$CLASSPATH
export PATH
=
$JAVA_HOME
/
bin
:$JRE_HOME
/
bin
:$PATH
|
Save and exit.
command to make the environment variable effective immediately:
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 . 32 tomcat |
3.2. Configure Environment variables
Use the VI command to open the/etc/profile file, terminal input:
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