In order to learn java, need a server, it was decided to use popular tomcat. According to on-line presentation on the installation of tomcat, the installation itself, and now has succeeded, and now recorded the installation process, but also for everybody to learn information.
First, from the official site to download tomcat package.
Click to download a version of the left, I chose tomcat6.x, you can select your own situation to install, click the hyperlink, select the Binary Distributions under the tar.gz (pgp, md5) zip file, download Second, after downloading to a local, to extract
# Tar zxvf apach-tomcat-6.0.16.tar.gz 【if the command does not help, use the following command】
Broken down into: # gunzip apach-tomcat-6.0.16.tar.gz
# Tar apach-tomcat-6.0.16.tar
# Mv apach-tomcat-6.0.16 / usr / local
【Here in the / usr / local can be as apache-tomcat-6.0.16 get hold of a shortcut, the command:
# Ln-s apache-tomcat-6.0.16 Tomcat6】
Third, the environment configuration for tomcat (if need to install the jdk) 【if you can not configure the direct implementation of the】
# Vi / etc / profile
export JAVA_HOME = "/ usr/local/jdk1.6.0_04"
export TOMCAT_HOME = "/ usr/local/apach-tomcat-6.0.16"
# Source / etc / profile / / to the current configuration take effect immediately
Fourth, start the tomcat server
$ / Usr/local/apach-tomcat-6.0.16/bin/startup.sh
【Under implementation or in the bin. / Startup.sh】
My computer will appear the following:
Using CATALINA_BASE: / usr/local/apache-tomcat-6.0.16
Using CATALINA_HOME: / usr/local/apache-tomcat-6.0.16
Using CATALINA_TMPDIR: / usr/local/apache-tomcat-6.0.16/temp
Using JRE_HOME: / usr/local/jdk1.6.0_20
5, using the "ps-ef | grep tomcat" tomcat has started to show
[Root @ bogon tomcat] # ps-ef | grep tomcat
root 7545 1 0 21:58 pts / 2 00:00:03 / usr/java/jdk1.6.0_20/bin/java-Djava.util.logging.config.file = / usr/local/apache-tomcat-6.0. 26/conf/logging.properties-Djava.util.logging.manager = org.apache.juli.ClassLoaderLogManager-Djava.endorsed.dirs = / usr/local/apache-tomcat-6.0.26/endorsed-classpath / usr / local / apache-tomcat-6.0.26/bin/bootstrap.jar-Dcatalina.base = / usr/local/apache-tomcat-6.0.26-Dcatalina.home = / usr/local/apache-tomcat-6.0.26-Djava . io.tmpdir = / usr/local/apache-tomcat-6.0.26/temp org.apache.catalina.startup.Bootstrap start
root 7908 5422 2 22:46 pts / 2 00:00:00 grep tomcat
6, test access
Method 1) in the browser, enter http://localhost:8080/ you will see the log of tomcat
This concludes the installation of tomcat.
Method 2) Use "wget http://localhost:8080 "to test the whether the Internet.
If you can not then turn off the firewall "service iptables stop", then ". / Shutdown.sh" end of the Tomcat service can also use the "kill PID" kill the Tomcat process.
7, add the following to the Tomcat from the start.
Method 1) modify / etc / rc.local file (this is the shortcut to the real file is / etc / rc.d / rc.local), then finally add the following content
JAVA_HOME = / usr/java/jdk1.6.0_16
[Root @ tpwb ~] # vi / etc / rc.d / rc.local
#! / Bin / sh
# This script will be executed * after * all the other init scripts.
# You can put your own initialization stuff in here if you don't
# Want to do the full Sys V style init stuff.
touch / var / lock / subsys / local
export JAVA_HOME = / usr/java/jdk1.6.0_16
# This is my directory so the system can automatically restart after the start Tomcat.
Method b) is not clear how this method, not collated
chmod + x tomcat
chkconfig - add tomcat
chkconfig tomcat on
Then restart linux, you can self-starting tomcat.
This article comes from CSDN blog, reproduced, please indicate the source: http://blog.csdn.net/striveman/archive/2008/04/21/2313374.aspx