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 and delete the file directly. 1) Delete the original JDK: # alternat
InstallMcAt first, install JDK. If CentOS updates the software package, an openJDK is installed by default. However, 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 package is from bin.ExtractPackage, CentOS, and REdYou can also run the rpm package on Hat. 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
ChmodChmod a + x jdk-6u26-linux-i586.bin
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 proFileFile
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:
ExportJAVA_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
DownloadCompressionPack 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.