Monday 24 June 2013

Installation of Apache Tomcat on Linux



Tomcat is a java development web server.
Prerequisites for tomcat:
1.  Java Development kit (JDK)
Installation of JDK On Linux:
First download jdk as a compressed file from internet. We have used jdk-1_5_0_03-linux-i586.bin file for installing jdk on fedora core 7.
Create a directory called java under / and download jdk-1_5_0_03-linux-i586.bin in it.
# mkdir  /java
# cd java
The downloaded file is a text file, so change it to executable using chmod.
# chmod +x jdk-1_5_0_03-linux-i586.bin
# ./ jdk-1_5_0_03-linux-i586.bin
This will execute the above file and ask for accepting license agreement. Enter “yes” to install the jdk. Hence a directory jdk1.5.0_03 will be created.
Now edit the file /etc/profile using vi editor to enter below lines.
export JAVA_HOME=/java/jdk1.5.0_03
******************************************************************************
Installing Tomcat
Create a directory “tomcat” under / and download the Jakarta-tomcat-4.1.12.tar.gz in it.
# mkdir  /tomcat
# cd  /tomcat
# wget http://archive .apache.org/dist/tomcat/tomcat-4/archive/v4.1.12/bin/jakarta-tomcat-4.1.12.tar.gz
# tar -xzvf  Jakarta-tomcat-4.1.12.tar.gz
This will create a directory jakarta-tomcat-4.1.12
# cd  Jakarta-tomcat-4.1.12
# cd bin
# ./startup.sh
This will start the tomcat (similarly use ./shutdown.sh to stop tomcat)
Test the tomcat by http://localhost:8080/ in the browser.
The tomcat web page will be displayed if tomcat is installed successfully.
******************************************************************************
Managing Tomcat using web admin tool
There is a directory “conf” in the /tomcat/jakarta-tomcat-4.1.12 folder which contains file called “tomcat-users.xml.
Edit this file to enter a new role by the name of “admin” and then adding a new user with admin role. This user will thus become the administrator of tomcat.
<role rolename=”admin” description=”tomcat administrator”/>
<user username=”test” password=”secure” roles=”admin”/>
Now open the tomcat webpage using http://localhost:8080 and then in the left side of the page navigate to “Tomcat Administration” and click it. This will ask for username & password. Enter the username as “test” and password “secure” to log on as administrator.
******************************************************************************

No comments:

Post a Comment