How you can install Apache Tomcat on centOS. Java isn't placed on my server. JDK or JRE (version 1.5 or 1.6) Which I have to install?.Help

Download JDK for Linux (such as this): jdk-6u20-linux-i586-revoltions per minute.bin (for Java 6 update 20 for linux!).

After your download, execute theses instructions:

[root@localhost ~]# cd Desktop/
[root@localhost Desktop]# chmod +x  jdk-6u20-linux-i586-rpm.bin

execute the JDK install:

[root@localhost Desktop]# ./jdk-6u20-linux-i586-rpm.bin

[root@centos ~]# yum -y remove java-1.4.2-gcj-compat

[root@localhost Desktop]# vi /etc/profile

After line -- # Functions and aliases use /etc/bashrc put this:

export JAVA_HOME=/usr/java/jdk1.6.0_20
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar

Attention for java version! And sites

[root@localhost Desktop]# source /etc/profile

[root@localhost Desktop]# java -version

Setting up tomcat 6: donwload tomcat at, Binary Distributions – Core, file .tar.gz. And execute:

[root@localhost Desktop]# tar zxvf apache-tomcat-6.0.26.tar.gz

[root@localhost Desktop]# mv apache-tomcat-6.0.26/ /usr/local/tomcat

[root@localhost Desktop]# rm -f apache-tomcat-6.0.26.tar.gz

[root@localhost Desktop]# vi /etc/profile

Add after Java's line:

export TOMCAT_HOME=/usr/local/tomcat
export CATALINA_HOME=/usr/local/tomcat

Execute this:

[root@localhost Desktop]# source /etc/profile

[root@localhost Desktop]# /usr/local/tomcat/bin/