install tomcat from source

Jump to: navigation, search

Download and Install JAVA

Download j2sdk-1.4.2 from Sun Download center

Here I have used j2sdk-1_4_2_18-linux-i586-rpm.bin which will install j2sdk using RPMS and set the Path of JAVA_HOME automatically

chmod +x j2sdk-1_4_2_09-linux-i586.bin

Now Check if Java is installed on the server using command java -version

[[email protected] ~]# java -version
java version “1.6.0_07″
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)

Download Tomcat

Now Download Tomcat from Apache Website and extract it

cd /usr/local/
tar -zxvf apache-tomcat-6.0.18.tar.gz

Create Symlink for the Tomcat Folder

ln -s /usr/local/apache-tomcat-6.0.18 /usr/local/apache/tomcat

Install Tomcat

cd apache-tomcat-6.0.18
cd bin
tar xvfz jsvc.tar.gz
cd jsvc-src
chmod +x configure
cp jsvc ..

Start Tomcat

Use Following script to start Tomcat Service on the Server


Running Tomcat as non root user

Due to security reasons always run tomcat as non-root user i.e. tomcat. To run it as tomcat first you will have to change the ownership of the tomcat folder

chown -R tomcat:tomcat /usr/local/apache-tomcat-6.0.18

Now Tomcat can be stopped and started under user tomcat using following commands:

su -l tomcat -c /usr/local/apache/tomcat/bin/
su -l tomcat -c /usr/local/apache/tomcat/bin/