Versions Compared

Key

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

...

Code Block
sudo groupadd tomcat
sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat

Download and Install Tomcat 

...

Excerpt

Find the latest version

Go to the tomcat downloads page, find the latest Binary Distributions section, then the Core sub-heading, and copy the tar.gz link.

Download Tomcat

On the linux server, goto the tmp directory then use curl to download from the link that you found above. E.g.

Code Block
cd /tmp
curl -O http://mirror.ox.ac.uk/sites/rsync.apache.org/tomcat/tomcat-9/v9.0.38/bin/apache-tomcat-9.0.38.tar.gz

Install Tomcat

Unpack the tomcat tar.gz file into /opt/tomcat.

Code Block
sudo mkdir /opt/tomcat
cd /opt/tomcat
sudo tar xvf /tmp/apache-tomcat-9*tar.gz --strip-components=1

This will have created the tomcat folders (conf, logs, webapps etc.) directly under /opt/tomcat.

Now to set the file ownership and permissions.

Code Block
cd /opt/tomcat
sudo chown -R tomcat webapps/ work/ temp/ logs/
sudo chgrp -R tomcat .
sudo chmod -R g+r conf
sudo chmod g+x conf


Create a service wrapper

This stage creates a wrapper which allows tomcat to be managed as a service; this allows tomcat to be stopped and started reliably, and ensures that the running environment (e.g. the starting directory) is well defined.

...