What is Apache tomcat?
Ans: An ApacheTomcat is an open source web application server which supports J2ee Servlet us, JavaServer, Pages (JSP) and API's. Tomcat should not be confused with Apache web server which an HTTP web server.
–From Wikipedia.
Some terminology about Apache tomcat.
An Apache Tomcat can be configured by editing server.xml file. This server.xml file of Tomcat can take as synonyms to httpd.conf file for Apache web server.
Servlet is defined as a way add dynamic content to a Web server using the Java platform. A servlet container is a compiled, executable program. The servlet container name of Tomcat is called as Catalina.
Prerequisite for Apache tomcat are
- java
- JDK
Step by step for installing Apache tomcat
Note: Avoide installing tomcat from repositories, always prefer to install it from source downloaded from Apache site.
Step1: Install all the prerequisites
Redhat:
#yum install java
Ubuntu:
#apt-get install java
Step2: Download tomcat source package and uncompress it.
Redhat/Ubuntu
#cd /opt
#wget http://www.trieuvan.com/apache/tomcat/tomcat-6/v6.0.29/bin/apache-tomcat-6.0.29.tar.gz
#tar xvfz apache-tomcat-6.0.29.tar.gz
Step3: Setup the paths for Catalina and others.
Setting catalina paths in Redhat/Ubuntu Linux
CATALINA_HOME=/opt/apache-tomcat-6.0.29
CATALINA_BASE=/opt/apache-tomcat-6.0.29
Setting java paths
Check what java versions are installed in your system
#update-alternatives --config java
This command will display default java version information used in your machine.
Example output :
# update-alternatives --config java
There are two programs which provide 'java'.
Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+2 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
Enter to keep the current selection[+], or type selection number:
If you see above the default java version is 1.6 so set the path to /usr/lib/jvm/jre-1.6.0-openjdk (* indicates the default version). Now set the path as shown below.
JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk
JDK_HOMe=$JAVA_HOME
Step4: Now start tomcat server
#/opt/apache-tomcat-6.0.29/bin/startup.sh
Sample output.
Using CATALINA_BASE: /opt/apache-tomcat-5.5.26
Using CATALINA_HOME: /opt/apache-tomcat-5.5.26
Using CATALINA_TMPDIR: /opt/apache-tomcat-5.5.26/temp
Using JRE_HOME:
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/
Step5: By default Apache Tomcat will be hosted on localhost : 8080 port by default. So try to access the site with your favorite web browser
http://localhost:8080
or
http://localhost:8080
or
http://systemname:8080
Stay tuned to other posts about troubleshooting tomcat installation.
Please visit https://www.linuxnix.com for more linux admin stuff.
Latest posts by Surendra Anne (see all)
- Docker: How to copy files to/from docker container - June 30, 2020
- Anisble: ERROR! unexpected parameter type in action:
Fix - June 29, 2020 - FREE: JOIN OUR DEVOPS TELEGRAM GROUPS - August 2, 2019
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018