Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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]# ./startup.sh
Cannot find apache-tomcat-8.0.18/bin/setclasspath.sh
This file is needed to run this program

~/.bashrc

# .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
fi
JAVA_HOME="/usr/lib/jvm/jre-1.7.0-openjdk.x86_64"
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH

export CATALINA_HOME="apache-tomcat-8.0.18"

Java Version

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

O/S

Linux server.myproject.com 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
like image 381
Jack Avatar asked Feb 07 '15 03:02

Jack


1 Answers

The Tomcat startup.sh script uses $CATALINA_HOME to find setclasspath.sh, 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

like image 101
mysteryegg Avatar answered Oct 16 '22 12:10

mysteryegg