Java – How to upgrade Tomcat on linux


My current running Tomcat is as following

Tomcat Version : Apache Tomcat/5.5.36
Servlet Specification Version : 2.4
JSP version : 2.0

I need to change it to

Tomcat Version : Apache Tomcat/8.0.14
Servlet Specification Version : 3.1
JSP version : 2.3

I downloaded Tomcat version 8 and I have following, how can I run Tomcat 8 and make it default of the server?

root@server [/opt]# ls
./                           cpanel/                    pcre/
../                          curlssl/                   php_with_imap_client/
apache-tomcat-8.0.18/        jdk1.7.0_75/               suphp/
apache-tomcat-8.0.18.tar.gz  jdk-7u75-linux-x64.tar.gz  xml2/

I tried following command but it failed.

root@server [/opt/apache-tomcat-8.0.18/bin]# ./
Cannot find apache-tomcat-8.0.18/bin/
This file is needed to run this program


# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
export JAVA_HOME
export PATH

export CATALINA_HOME="apache-tomcat-8.0.18"

Java Version

java -version
java version "1.7.0_75"
OpenJDK Runtime Environment (rhel- u75-b13)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)
root@server [/opt/apache-tomcat-8.0.18/bin]# 


Linux 2.6.32-220.13.1.el6.x86_64 #1 SMP Tue Apr 17 
23:56:34 BST 2012 x86_64 x86_64 x86_64 GNU/Linux

Best Solution

The Tomcat script uses $CATALINA_HOME to find, which is the cause of your failed startup. Therefore, $CATALINA_HOME needs to be an absolute path to your tomcat installation directory, e.g.

export CATALINA_HOME="/opt/apache-tomcat-8.0.18"

If you plan on upgrading again, you might consider setting $CATALINA_HOME to /opt/tomcat, then you would create a symbolic link from /opt/tomcat to /opt/apache-tomcat-8.0.18 or whatever future version you end up installing. Since you will likely have multiple environmental variables pointing to your tomcat directory, this gives you a single change point when updating references.

ln -nsf /opt/apache-tomcat-8.0.18 /opt/tomcat