Apache Tomcat is a popular Java Servlet Container, and keeping it up to date ensures improved performance, stability, and security. This blog walks you through upgrading to Apache Tomcat 9.0.98 on a Linux server, taking necessary backups, and verifying the installation.
Step 1: Download and Extract Apache Tomcat 9.0.98
- Open your terminal and navigate to a preferred directory and download the latest version of Apache Tomcat 9.0.98 using the following link:
wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.98/bin/apache-tomcat-9.0.98.tar.gz
- Extract the tar file:
tar -xvf apache-tomcat-9.0.98.tar.gz
Step 2: Stop the Current Tomcat Service and Backup Existing Directory
- Stop the running Tomcat service:
cd $DLC_HOME/servers/pasoe/bin/ ./tcman.sh stop
Note: It is good practice to stop all progress services before starting an upgrade
- Take a backup of the existing Tomcat directory:
tar -zcf pasoe_tomcat.9.0.81.tgz pasoe
Here, pasoe is the directory of the current Tomcat instance. Ensure to name the backup file descriptively for easier identification
Step 3: Copy Required Configuration Files and JARs
- Replace the necessary configuration files and JARs from the extracted Tomcat 9.0.98 directory to your existing setup.
Use the following commands to copy:cp apache-tomcat-9.0.98/bin/bootstrap.jar $DLC_HOME/servers/pasoe/bin/bootstrap.jar cp apache-tomcat-9.0.98/lib/*.jar $DLC_HOME/servers/pasoe/lib/ cp apache-tomcat-9.0.98/bin/catalina.sh $DLC_HOME/servers/pasoe/bin/catalina.sh cp apache-tomcat-9.0.98/bin/daemon.sh $DLC_HOME/servers/pasoe/bin/daemon.sh cp apache-tomcat-9.0.98/bin/setclasspath.sh $DLC_HOME/servers/pasoe/bin/setclasspath.sh cp apache-tomcat-9.0.98/bin/bootstrap.jar $OEM/bin/bootstrap.jar cp apache-tomcat-9.0.98/lib/*.jar $OEM/lib/
Step 4: Start the Tomcat Service
- Once the above steps are completed, restart the Tomcat service using the below command:
cd $DLC_HOME/servers/pasoe/bin/ ./tcman.sh start
- Verify that the service is running properly and check the version:
cd $DLC_HOME/servers/pasoe/bin/ ./tcman.sh version
You should see output similar to:
Server version: Apache Tomcat/9.0.98 Server built: Dec 5 2024 19:50:29 UTC Server number: 9.0.98.0 OS Name: Linux OS Version: 4.18.0-553.33.1.el8_10.x86_64 Architecture: amd64 JVM Version: 11.0.25+9-LTS JVM Vendor: Red Hat, Inc.
Key Points to Remember
- Always stop the Tomcat service before making changes.
- Backup the existing directory to ensure you can roll back in case of issues.
- Replace only the necessary files and maintain your custom configurations.
- Verify the Tomcat version after starting the service to ensure the upgrade was successful.
With these steps, you’ve successfully upgraded Apache Tomcat to version 9.0.98. Enjoy the benefits of the latest features and enhancements!