To install Tomcat, you must first install JDK. if CentOS updates the software package, an openJDK is installed by default. However, it is not as good as SunJDK to solve some problems, we first unload the system's default JDK, and then we will next the latest jdk package from the official website. 1. uninstall the JDK of the system...
To install Tomcat, you must first install JDK. if CentOS updates the software package, an openJDK is installed by default, but it does not feel as good as SunJDK when dealing with some problems.
Here, we first unload the default JDK of the system, and then we will next the latest jdk package from the official website.
1. uninstall the JDK of the system and delete the file directly.
1) delete the original JDK:
# Alternatives -- remove jar/usr/bin/fastjar
# Alternatives -- remove jar.1.gz/usr/share/man/man1/fastjar.1.gz
2) delete the original link:
# Cd/usr/bin
# Rm-rf java
# Rm-rf javac
3) delete the original java Directory
# Rm-rf/usr/java/
2. download the latest JDK package and go to the official website. Generally, the bin self-decompressed package, CentOS, and redhat can also be used as the rpm package. However, the bin package supports all Linux kernels. here we use the bin package as an example.
Jdk package: jdk-6u26-linux-i586.bin
Grant the current user execution permission
Chmod a + x jdk-6u26-linux-i586.bin www.2cto.com
Run the installation file
/Jdk-6u26-linux-i586.bin
3. configure JDK1.6
Set up a soft connection to jdk under the/usr/bin directory. This document is from the internet. I haven't figured out the specific cause for the moment, but it's easy because I tried it.
# Ln-s/usr/java/jdk1.5.0 _ 17/bin/java/usr/bin/java
# Ln-s/usr/java/jdk1.5.0 _ 17/bin/javac/usr/bin/javac
To facilitate subsequent work, two soft links are also created under/usr/lcoal.
# Ln-s/usr/java/jdk1.5.0 _ 17/usr/local/jdk
# Ln-s/usr/java/jdk1.5.0 _ 17/jre // usr/local/jre
3. modify the configuration file
Vim modify profile file
Vim etc/profile
Add
JAVA_HOME =/usr/local/jdk
JRE_HOME =/usr/local/jre
PATH = $ PATH: $ JAVA_HOME/bin: JRE_HOME/bin
CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar: $ JRE_HOME/lib:
Export JAVA_HOME JRE_HOME PATH CLASSPATH
You can also write down the following (the premise is that there is a JDK soft connection under the/usr/bin directory)
JAVA_HOME =/usr/local/jdk
JRE_HOME =/usr/local/jre
PATH = $ PATH: $ JAVA_HOME/bin: JRE_HOME/bin
CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar: $ JRE_HOME/lib:
Export JAVA_HOME JRE_HOME PATH CLASSPATH
Make the configuration file take effect
Source/etc/profile
Now JDK should be installed. if you enter java-version to display the current jdk version, it indicates it is OK.
4. install Tomcat
Download compressed package apache-tomcat-5.5.33.tar.gz
Decompress the package to the directory you want to install.
Tar-zvxf apache-tomcat-5.5.27.tar.gz
Start Tomcat
Go to the bin/Directory
./Startup. sh
The following information is displayed:
Using CATALINA_BASE:/usr/local/tomcat
Using CATALINA_HOME:/usr/local/tomcat
Using CATALINA_TMPDIR:/usr/local/tomcat/temp
Using JRE_HOME:/usr/local/jre
It indicates that the installation of tomact is successful. open the browser and enter http: // localhost: 8080. you can see the tomcat page.
From: txg703003659 column