One. Download and install the corresponding JDK and configure the Java environment.
Website:
Http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u26-download-400750.html
Download the JDK and put it into the/usr/local directory:
[Root@master ~] #chmod 755 Jdk-6u5-linux-x64.bin
[Root@master ~]#./jdk-6u5-linux-x64.bin
[Root@master ~] #mv jdk1.6.0_05/usr/local
establishing a JDK soft connection under/usr/local/facilitates later version upgrades:
[Root@master ~]# ln-s/usr/local/jdk1.6.0_05//usr/local/jdk
To Configure environment variables:
Add the following to the/etc/profile:
java_home=/usr/local/jdk1.6.0_05
Java_bin=/usr/local/jdk1.6.0_05/bin
path= $PATH: $JAVA _bin
classpath= $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
export java_home java_bin PATH CLASSPATH
Save exit
[Root@master ~]source/etc/profile
See if the Java environment variable is in effect
[Email protected] ~]# java-version
Java Version "1.6.0_05"
Java (TM) SE Runtime Environment (build 1.6.0_05-b13)
Java HotSpot (TM) 64-bit Server VM (build 10.0-b19, Mixed mode)
Test success
two. Download install tomcat(http://tomcat.apache.org/)
[Email protected] ~]# Unzip Apache-tomcat-6.0.30.zip
[Email protected] ~]# MV apache-tomcat-6.0.30//usr/local/
[Email protected] ~]cd/usr/local/
[Email protected] local]# ln-s/usr/local/apache-tomcat-6.0.30//usr/local/tomcat
[Email protected] local]# CD tomcat/bin/
[[email protected] bin] #ls
[[email protected] bin] #vim catalina.sh
Add the following content:
catalina_home=/usr/local/apache-tomcat-6.0.30/
[Email protected] local]#chmod +x *.sh
three. Start the Tomcat server
[[email protected] tomcat]# /usr/local/tomcat/bin/catalina.sh start
Using catalina_base:/usr/local/apache-tomcat-6.0.30/
Using catalina_home:/usr/local/apache-tomcat-6.0.30/
Using catalina_tmpdir:/usr/local/apache-tomcat-6.0.30//temp
Using jre_home:/usr/local/jdk1.6.0_05
Using CLASSPATH:/usr/local/apache-tomcat-6.0.30//bin/bootstrap.jar
[Email protected] logs]# cd/usr/local/tomcat/logs/
[Email protected] logs]# tail-f catalina.out
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:25)
At Java.lang.reflect.Method.invoke (method.java:597)
At Org.apache.catalina.startup.Bootstrap.start (bootstrap.java:289)
At Org.apache.catalina.startup.Bootstrap.main (bootstrap.java:414)
Jul 4, 11:06:57 AM org.apache.coyote.http11.Http11Protocol Pause
Info:pausing Coyote http/1.1 on http-8080
Jul 4, 11:06:58 AM org.apache.catalina.core.StandardService stop
Info:stopping Service Catalina
Jul 4, 11:06:58 AM Org.apache.coyote.http11.Http11Protocol destroy
Info:stopping Coyote http/1.1 on http-8080
Four. Enter in the browser
http://localhost:8080/(if not native, enter the corresponding IP address)
Test appears when Tomcat page is tested successfully
PS: It is necessary to note that the default test page for Tomcat is placed under WebApps, which is actually configured in the Server.xml file as follows:
Unpackwars= "true" autodeploy= "true"
Xmlvalidation= "false" Xmlnamespaceaware= "false" >
[[Email protected]_sys apache-tomcat-6.0.30]# ls
LICENSE NOTICE release-notes RUNNING.txt bin conf lib logs temp WebApps work
1) The WebApps folder is primarily used for Web application deployment, such as you can copy your application packages, such as war files, into that directory, and containers are automatically deployed.
2) The Conf folder is primarily a configuration file for the server where Tomcat is placed
Five. Add an app and test again
The test package is decentralized in the WebApps directory ( Note: The Webaapps directory is mostly placed under the application package. War is automatically decompressed after Tomcat restart Access )
[email protected] webapps]# pwd
/usr/local/tomcat/webapps
[email protected] webapps]# TAR-ZXVF moni2.tar.gz
[[email protected] webapps]# ls
Docs Examples Host-manager Manager moni2 moni2.tar.gz ROOT
[[email protected] webapps]#/usr/local/tomcat/bin/catalina.sh start (restart Tomcat)
Using catalina_base:/usr/local/apache-tomcat-6.0.30/
Using Catalina_home:/usr/local/apache-tomcat-6.0.30/
Using Catalina_tmpdir:/usr/local/apache-tomcat-6.0.30//temp
Using Jre_home:/usr/local/jdk1.6.0_05
Using CLASSPATH:/usr/local/apache-tomcat-6.0.30//bin/bootstrap.jar
Enter the following address in the browser:
http://192.168.55.229:8080/moni2/
Six. Modify Tomcat's Listening port
[Email protected] ~]# cd/usr/local/tomcat/conf
[[email protected] ~]# ls
[Email protected] ~]# vim Server.xml
<server port= "8005" shutdown= "Shutdown" > "Port when Tomcat is stopped"
<connector port= "8081" protocol= "http/1.1"
connectiontimeout= "20000"
redirectport= "8443"/> "Tomcat default listening port is 8080, now change to 8081"
<connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/> "apache+tomcatmode when accessing Tomcat ports"
now reboot Tomcat. Visit http://192.168.55.229:8081/moni2/"Note: At this point you need to modify the port, hey ... "
Seven. Create a Tomcat instance
If the address we are using now is: 192. 168.55.229, if we want to create a Tomcat instance on the machine, but the script we created the instance is on the server 192.168.55.233, then what do we need to do, see the following steps:
[[email protected] ~]# mount-t NFS 192.168.55.233:/opt/nfs/nfs "mount directory"
[Email protected] ~]# cd/nfs/
[[email protected] nfs]# ls
Tcfile
[Email protected] nfs]# CD tcfile/
[[email protected] tcfile]# ls
Backupfile deployfile instancefile
[[email protected] instancefile]# ls
Tomcattemplate Tomcattemplate.zip
[Email protected] instancefile]# CD tomcattemplate
[[email protected] tomcattemplate]# ls
Bin conf lib LICENSE logs NOTICE release-notes RUNNING.txt temp WebApps work
[[Email protected] tomcattemplate]# CDbin
[[email protected] bin]# ls
Bootstrap.jar Commons-daemon.jar createresource.sh resource.properties startup.bat Tool-wrapp er.sh
C3p0.template commons-daemon-native.tar.gz digest.bat setclasspath.bat startup.sh version.ba T
Catalina.bat cpappend.bat digest.sh setclasspath.sh Tomcat-juli.jar version.sh
catalina.shcreateinstance.shEncrypt.bat Shutdown.bat tomcat-native.tar.gz
Catalina-tasks.xml CreateInstance.sh.bak encrypt.sh shutdown.sh tool-wrapper.bat
[[email protected] bin]# sh createinstance.sh tomcatserver229-1 "create instance"
/nfs/tcfile/instancefile/tomcattemplate
New instance Tomcatserver229-1 has successfully builded, and
shutdown.port=10001
ajp.port=8011
http.port=8081
https.port=8041
jmx.port=6901
[[email protected] bin]# cd/opt/oracle/tomcat/"can be viewed under this directory"
[[email protected] tomcat]# ls
tomcatserver229-1 "naming rules, by default, are Tomcat names +-n represent the first few instances;
[Email protected] tomcat]#
Installation configuration for Tomcat under Linux