Apache tomcat is a Java based application server released by the Apache
Software Foundation. It is a web server and a servlet container for Java
web applications.
You do need to have a user with sudo privileges for this tutorial.
There are two basic ways to install Tomcat on Ubuntu:
. ~/.bashrc
The final step is to activate Tomcat by running its startup script:
You can visually verify that Tomcat is working by accessing your server page at your_IP_address:8080.
It should look like
Let's take a look at the Web Application Manager, accessible via the link or
Setup
Tomcat installation on a virtual private server is relatively easy. Its single required dependency is Java and this tutorial will include a step on how to install that platform.You do need to have a user with sudo privileges for this tutorial.
There are two basic ways to install Tomcat on Ubuntu:
- Install through apt-get. This is the simplest method.
- Download the binary distribution from the Apache Tomcat site.
Step One—Install Through apt-get
The first thing you will want to do is update your apt-get package lists:
sudo apt-get update
The most recent version of Tomcat is 7, and it can be easily downloaded through apt-get
sudo apt-get install tomcat7
Install additional packages
sudo apt-get install tomcat7-docs tomcat7-admin tomcat7-examples
Step Two—Install Through Binary Distribution
To download tomcat from their site, copy the link for the tar.gz package
under the “Core” section and begin the download. You will get a link
that originates from one of Apache’s many mirrors, making the command
look mostly like this (although coming from a different site).
wget http://mirrors.ispros.com.bd/apache/tomcat/tomcat-7/v7.0.55/bin/apache-tomcat-7.0.55.tar.gz
After the download completes, untar the file.
tar xvzf apache-tomcat-7.0.29.tar.gz
We first see the tomcat directory structure
here each folder uses following purpose.
bin - It contains all binary and script files for running tomcat.
lib - contains all shared libraries used for tomcat
conf - contains configuration information like which port tomcat can bind , etc...
logs - it contain all logging details
temp - this folder tomcat used for temporary files purpose
webapps - this folder is very important. here we put all application war files.
work - If application contain any jsp then jsp is translated and converted into servlet its stores here.
When we run Tomcat, it uses 5 environment variables. They are:
- CATALINA_HOME
- CATALINA_BASE
- CATALINA_TMPDIR
- JRE_HOME/JAVA_HOME
- CLASSPATH
In the above
list, CATALINA_HOME and JAVA_HOME are mandatory environment variables.
All others are optional and can be calculated using CATALINA_HOME.
CATALINA_HOME
– this environment variable should point to tomcat base folder, where
tomcat binary are installed/extracted. so based on CATALINA_HOME we
can get bin and lib folder
CATALINA_BASE
– If we not specified then CATALINA_HOME value is set. This variable
pointed to configuration and webapps folder. Based on this variable
server uses conf, logs, temp, webapps, work folders.
Step Three—Configure .bashrc
In order to start Tomcat, we need to add it as an environment variable in the /.bashrc file.
sudo nano ~/.bashrc
You can add this information to the end of the file:
export JAVA_HOME=/usr/lib/jvm/default-java
export PATH=$JAVA_HOME/bin:$PATH
export CATALINA_HOME=~/path/to/tomcat
Save and exit out of .bashrc. You can make the changes effective by restarting the bashrc file.
. ~/.bashrc
Step Four—RUN
Tomcat is now installed and configured on our virtual servers. However, it is not yet activated.
$CATALINA_HOME/bin/startup.sh
Once that runs, Tomcat is up and ready on port 8080.
You can visually verify that Tomcat is working by accessing your server page at your_IP_address:8080.
It should look like
http://your_ip_address:8080/manager/
:
Comments
Post a Comment