How to Install Tomcat Server on Linux?

Apache  tomcat is  a  open source software  implementation of the Java technologies  like Java WebSocket, Java Expression Language technologies.To deploy any application you  just need to create  a war file and deploy it on tomcat.Also for  more  details you can check this  link.

This  KB  ‘ll help you how to install  tomcat  on linux server.We ‘ll  use  Red Hat  6  while performing a  new  installation below.

What you need?

  • Download  all binaries from tomcat
  • Check  Java  version.If  java  doesn’t  exist  install it.
  • Create  an application  mount  point for  spesific  application  installation.
  • Exract file and  start  tomcat.

Let’s  start  installation with  first step to  download  binaries. You can  get all binaries  from  this  link.I recommend  to  download core  binary  distribution which named  tar.gz.

  • Download  Package:

There  is two  option.First  you can  download package  with  wget  command or  dowload  it from explorer then  put  tar.gz  file under  directory.

#wget   http://ftp.itu.edu.tr/Mirror/Apache/tomcat/tomcat-7/v7.0.65/bin/apache-tomcat-7.0.65.tar.gz 
drwxr-xr-x. 3 appdata app 4096 Nov 3 14:56 /appdata/
-bash-4.1$ df -h /appdata/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgroot-LogVol02 11G 169M 10G 2% /appdata
-bash-4.1$ ls -ld /appdata/*
-rw-r--r--. 1 appdata app 14008320 Nov 3 14:38 /appdata/apache-tomcat-7.0.65.tar
drwx------. 2 root root 16384 Nov 3 12:52 /appdata/lost+found
-bash-4.1$ id
uid=501(appdata) gid=502(app) groups=502(app) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
-bash-4.1$ 
  • Check  Java  version  .If  java  doesn’t exist download  it from  this  link.
-bash-4.1$ java -version
java version "1.7.0_45"
OpenJDK Runtime Environment (rhel-2.4.3.3.el6-x86_64 u45-b15)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
-bash-4.1$ which java
/usr/bin/java
-bash-4.1$ 
  • Extract  Binary file:

**It’s  important  to extract  binary  files  with  application  user. 

-bash-4.1$ ls -ld *
-rw-r--r--. 1 appdata app 14008320 Nov 3 14:38 apache-tomcat-7.0.65.tar
drwx------. 2 root root 16384 Nov 3 12:52 lost+found
-bash-4.1$ tar -xvf apache-tomcat-7.0.65.tar |more
apache-tomcat-7.0.65/bin/catalina.sh
apache-tomcat-7.0.65/bin/configtest.sh
apache-tomcat-7.0.65/bin/daemon.sh
apache-tomcat-7.0.65/bin/digest.sh
apache-tomcat-7.0.65/bin/setclasspath.sh
  • Start  tomcat
-bash-4.1$ pwd
/appdata/apache-tomcat-7.0.65/bin
-bash-4.1$ ./startup.sh
Using CATALINA_BASE: /appdata/apache-tomcat-7.0.65
Using CATALINA_HOME: /appdata/apache-tomcat-7.0.65
Using CATALINA_TMPDIR: /appdata/apache-tomcat-7.0.65/temp
Using JRE_HOME: /usr
Using CLASSPATH: /appdata/apache-tomcat-7.0.65/bin/bootstrap.jar:/appdata/apache-tomcat-7.0.65/bin/tomcat-juli.jar
Tomcat started.
-bash-4.1$ 
  • Check Port  State
-bash-4.1$ lsof -i :8080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 29647 appdata 43u IPv6 40519 0t0 TCP *:webcache (LISTEN)
-bash-4.1$ 
  • Create  an admin account for  tomcat

The  last step we  need to create a  admin account  for tomcat.

 

-bash-4.1$ pwd
/appdata/apache-tomcat-7.0.65/conf
-bash-4.1$ vi tomcat-users.xml 

Change  this  line as  you wish and  add them “tomcat-users.xml

<!-- user manager can access only manager section -->
<role rolename="manager-gui" />
<user username="manager" password="manager123" roles="manager-gui" />

<!-- user admin can access manager and admin section both -->
<role rolename="admin-gui" />
<user username="admin" password="admin123" roles="manager-gui,admin-gui" />

 

Tagged In:

I'm a IT Infrastructure and Operations Architect with extensive experience and administration skills and works for Interbank Card Center Of Turkey(BKM). I provide hardware and software support for the IT Infrastructure and Operations tasks.

129 Total Posts
Follow Me

0 Comments

Leave a Reply