Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Whatever you do please read the FINAL STEPS at the bottom of the page. 

 

tomcat user:

  • Make sure a user, tomcat, has been created with no privileges, no shell. (e.g. tomcat:x:506:99::/home/tomcat:/sbin/nologin).  If you are unsure how to do this please contact SysAdmin for assistance (e.g. sudo useradd -M -s /usr/bin/nologin -g nobody tomcat).

 

Java installation/update:

...

--no-check-certificate \0

--header "Cookie: oraclelicense=accept-securebackup-cookie" \

"http://download.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.tar.gz"

...

For Java 8, check "http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html" and select the bundle corresponding to "Linux x64", if using linux 64 bits.

  • Once the file has completed downloading untar the java distribution and delete the tar file ( sudo tar zxvf jdk-7u55-linux-x64.tar.gz ).
  • If the directory, /opt/java, did not exist create a "current" symlink to the new java directory (e.g. sudo ln -s jdk-7u55-linux-x64 current). If the directory, /opt/java, did exist and the link, current, was already there then you will need to sudo unlink current before linking it again.  NOTE: The reason for symlinking the directory is so any references to the current java installation (e.g. $JAVA_HOME, /etc/profile.d/java.sh...) do not have to be updated.  This simplifies maintenance.
  • Remove any previous Java installation from the system. In Centos, get a list of packages:

...

NOTE: If you have installed java/components you may need to redirect the installed links (e.g. /etc/alternatives/java...) to point to /opt/java/current.

/etc/init.d/tomcat7tomcat8
The following configuration is the script that will start/stop/restart the Tomcat server both from the command line and executed when the system is restarted.  From the command line usually executed by calling - sudo service tomcat7 stop/start/restart  
In both cases the Tomcat server will be started to run with the permissions of the tomcat user.

    • If an entry for tomcat7 tomcat8 does not exist in /etc/init.d/tomcat7 tomcat8 then you will need to create one.  Attached to this issue is a file, initd-tomcat7.  Open the file and copy the contents into sudo vi /etc/init.d/tomcat8. Change all instances of tomcat7 to tomcat8 in this file.  Save Save the file (e.g. :wq).
      If an entry for tomcat7 tomcat8 already exists be sure it contains a similar if not identical code as the attached file otherwise the Tomcat server may not be correctly started. 
    • Finally to be sure the the script will be executed upon startup run the following command  sudo chkconfig /etc/init.d/tomcat7tomcat8


Tomcat installation/update:

  1. If  the server does not already have a directory, /opt/apache-tomcat, then create one (sudo mkdir /opt/apache-tomcat) and download the tomcat installation to this directory. Be sure to check the sha1 or md5 hash on the download site is the same as for the downloaded tomcat file (You can download tomcat8 using the following command: sudo wget http://www.gtlib.gatech.edu/pub/apache/tomcat/tomcat-8/v8.0.20/bin/apache-tomcat-8.0.20.tar.gz
  2. Be sure to check the sha1 or md5 hash on the download site is the same as for the downloaded tomcat file (e.g. openssl dgst -md5 apache-tomcat-7.0.xx.tar.gz). This should match the value at https://www.apache.org/dist/tomcat/tomcat-8/v8.0.20/bin/apache-tomcat-8.0.20.tar.gz.md5
  3. Untar the tomcat distribution and delete the tar file (sudo tar cxf zxvf apache-tomcat-78.0.xx20.tar.gz).
  4. If the directory, /opt/apache-tomcat/current, did not exist create a "current" symlink to the new tomcat server directory (e.g. sudo ln -s apache-tomcat-78.0.xx 20 current). If the directory, /opt/apache-tomcat, did exist and the link, current, was already there then you will need to sudo unlink current before linking it again.  NOTE: The reason for symlinking the directory is so any references to the current tomcat server (e.g. $CATALINA_HOME, /etc/init.d/tomcat7tomcat8...) do not have to be updated.  This simplifies maintenance.
  5. This concludes the steps necessary to install or update the version of Tomcat. Please see Tomcat configuration for steps required to configure Tomcat.

...