Apache Tomcat, an open source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket developed by the Apache Software Foundation has recently been updated to version 9.0.12…
This brief tutorial will show students and new users how to install / upgrade Tomcat to version 9.0.12 on Ubuntu 16.04 | 18.04 LTS servers…
This release brings some bug fixes and correction as well as enhancements with some modules, including an improvement in handling of path parameters, process requests, a potential fix to deadlocks and corrupt response bodies….
For more about this release, please check it changelog page…
Below is a complete changelog of what was included with this release…
- Improve the handling of path parameters when working with RequestDispatcher objects. (markt)
- Process requests with content type multipart/form-data to servlets with a @MultipartConfig annotation regardless of HTTP method. (markt)
- When using the SSIFilter and a resource does not specify a content type, do not force the content type to application/x-octet-stream. (markt)
- Adjust the memory leak protection for the DriverManager so that JDBC drivers located in $CATALINA_HOME/lib and $CATALINA_BASE/lib are loaded via the service loader mechanism when the protection is enabled. (markt)
- Add recursion to rewrite substitution parsing. (remm)
- When generating a redirect to a directory in the Default Servlet, avoid generating a protocol relative redirect. (markt)
- Fix potential deadlocks when using asynchronous Servlet processing with HTTP/2 connectors. (markt)
- Fix corruption of response bodies when writing large bodies using asynchronous processing over HTTP/2. (markt)
- Additional fixes for output corruption of response bodies when writing large bodies using asynchronous processing over HTTP/2. (markt)
- Support for Netware in the org.apache.tomcat.jni package has been removed as there has not been a supported Netware platform for a number of years. (markt)
- Correct the JSP version in the X-PoweredBy HTTP header generated when the xpoweredBy option is enabled. (markt)
- Fix the corruption of web.xml output during JSP compilation caused by the fix for.. Patch provided by Bernhard Frauendienst. (markt)
Step 1: Installing Tomcat on Ubuntu
Tomcat requires Java JDK to be installed in order to function… To install the original Java package, follow the guide below:
The easiest way to install Oracle Java JDK 8 on Ubuntu is via a third party PPA… To add that PPA, run the commands below
sudo add-apt-repository ppa:webupd8team/java
After running the commands above, you should see a prompt to accept the PPA key onto Ubuntu… accept and continue
Now that the PPA repository has been added to Ubuntu, run the commands below to download Oracle Java 8 installer…. the installer should install the latest Java JDK 8 on your Ubuntu machines.
sudo apt update sudo apt install oracle-java8-installer
When you run the commands above you’ll be prompted to access the license terms of the software… accept and continue..
Set Oracle JDK8 as default, to do that, install the oracle-java8-set-default package. This will automatically set the JAVA env variable.
sudo apt install oracle-java8-set-default
Now that JAVA is installed, run the commands below to set its home directory….
sudo nano /etc/environment
Then copy and paste the hightlighted line below and save the file…
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" JAVA_HOME=/usr/lib/jvm/java-8-oracle export JAVA_HOME
After that run the commands below…
When you run echo $JAVA_HOME you should now see Java home directory…
Step 2: Download Tomcat Packages
Now that Java JDK is installed, run the commands below to donwnload Tomcat packages..
cd /tmp && wget http://mirrors.sonic.net/apache/tomcat/tomcat-9/v9.0.12/bin/apache-tomcat-9.0.12.tar.gz
Then run the commands below to extract the downloaded packages.
tar -xzf apache-tomcat-9.0.12.tar.gz
Create a directory for Tomcat files… and move the files there by running the commands below….
sudo mv apache-tomcat-9.0.12 /opt/tomcat9
Create Tomcat 9 user by running the commands below… this users will own the Tomcat directory content..
sudo useradd -r tomcat9 --shell /bin/false
Then give Tomcat 9 user control of the directory…
sudo chown -R tomcat9 /opt/tomcat9
Step 3: Configure Tomcat9 Service
Now that the pakcage is extracted, run the commands to open Tomcat configuration file for its default user
sudo nano /opt/tomcat9/conf/tomcat-users.xml
Then create an account with password for the user and save by copying and pasting the line below into the file.. just before the </tomcat-users>
<role rolename="manager-gui"/> <role rolename="admin-gui"/> <user username="admin" password="password_here" roles="manager-gui,admin-gui"/>
Save the file and exti..
Next, run the commands below to create a server account for Tomcat
sudo nano /etc/systemd/system/tomcat.service
then copy and paste the lines below into the file and save
[Unit] Description=Tomcat9 After=network.target [Service] Type=forking User=tomcat9 Group=tomcat9 Environment=CATALINA_PID=/opt/tomcat9/tomcat9.pid Environment=JAVA_HOME=/usr/lib/jvm/java-8-oracle/ Environment=CATALINA_HOME=/opt/tomcat9 Environment=CATALINA_BASE=/opt/tomcat9 Environment="CATALINA_OPTS=-Xms512m -Xmx512m" Environment="JAVA_OPTS=-Dfile.encoding=UTF-8 -Dnet.sf.ehcache.skipUpdateCheck=true -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+UseParNewGC" ExecStart=/opt/tomcat9/bin/startup.sh ExecStop=/opt/tomcat9/bin/shutdown.sh [Install] WantedBy=multi-user.target
Save and exit.
sudo systemctl daemon-reload sudo systemctl start tomcat.service sudo systemctl restart tomcat.service sudo systemctl enable tomcat.service
Now, open your browser and browse to the local server IP or hostname
and you should see Tomcat default page..
Click on the Manager App to logon to the backend page…
You may also like the post below: