Installation configuration for Tomcat under Linux

Source: Internet
Author: User
Tags server port tomcat server

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:

[[Email protected] ~] #chmod 755 Jdk-6u5-linux-x64.bin

[Email protected] ~]#./jdk-6u5-linux-x64.bin

[[Email protected] ~] #mv jdk1.6.0_05/usr/local

Establishing a JDK soft connection under/usr/local/facilitates later version upgrades:

[Email protected] ~]# 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

[Email protected] ~]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

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.