A good link to use – https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04 However, this installs Tomcat for public exposure.
I chose to install it in my personal account. The primary reason was to put it in a non-sudo directory so it would be easier to work with. It is running on my personal laptop with no other users. Another reason was I wanted to easily run my Servlet in my local directory for testing and mirroring sites that might use them.
The structure I’m using:
tomcat* (this entire tomcat install)
Steps I used
- I did create a tomcat group – sudo groupadd tomcat
- I did not create a tomcat user and assign its directory above as `useradd` will not create a user using tomcat8
- I created private structure – mkdir tomcat ; mkdir tomcat/tomcat8
- I installed tomcat into tomcat8 – tar xzvf Downloads/apache-tomcat-8.5.27.tar.gz -C /home/roye/tomcat/tomcat8 –strip-components=1
- I changed the group – chgrp -R tomcat tomcat8
- I changed – chmod -R g+r conf ; chmod -R g+x conf
docBase WEB-INF web.xml <- configures which servlets are used, welcome pages, security
issues classes <- a directory containing the servlets and supporting classes.
This is a root classes must be locate below by their package name
static_content <- html, php and other content not associated with the site's
configuration or servlets
Setting up Tomcat for remote debugging using Eclipse
Summarized from https://confluence.sakaiproject.org/display/BOOT/Setting+Up+Tomcat+For+Remote+Debugging
We recommend adding this stuff to your startup script so that you are always running tomcat in debug mode.
- Open the startup script in (your_tomcat_home)/bin/startup.sh
- Add the following lines at the first blank line in the file (around line 8)
- Change the execute line at the end to include jpda start
- Run the startup script when starting tomcat to run tomcat in debug mode
Setup up Eclipse
copied from http://starredmediasoft.com/tomcat-configure-remote-debugging/ on eclipse do the following steps:
- Select project to debug
- Choose “Debug configurations..” on Debug menu
- On “Remote Java Application” left menu, click “New Launch Configuration” button
- On Connection Type, select “Standard (Socket Attach)” combo item
- Type on the listening port (on the above tomcat configuration, was 8000)
- Click on Debug and start listening