You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

请求提供RHEL 8.10环境下Apache Tomcat从9.0.104版本迁移至9.0.105/9.0.109或最新版本的完整步骤

Step-by-Step Guide to Upgrade Apache Tomcat on RHEL 8.10 (9.0.104 → 9.0.105/9.0.109/Latest 9.x)

Hey there, let's get your Tomcat upgraded safely to patch those vulnerabilities. I’ll walk you through every step, assuming you’ve got a standard Tomcat setup (just adjust paths if yours is custom).

Prerequisites

  • You have sudo/root access to your RHEL 8.10 server
  • Tomcat is currently running (we’ll stop it first)
  • You know the user/group Tomcat runs as (usually tomcat:tomcat)

1. Stop Tomcat & Backup Everything First

Always start with a backup—this is your safety net if something goes wrong.

  • Stop the Tomcat service:
    # If using systemd (most common setup)
    sudo systemctl stop tomcat
    
    # If using the shutdown script directly
    sudo /usr/local/tomcat/bin/shutdown.sh
    
  • Create a full backup of your current Tomcat installation:
    sudo tar -czf tomcat-backup-$(date +%Y%m%d).tar.gz /usr/local/tomcat
    
    Store this backup in a safe location (preferably not on the same server).

2. Download the Target Tomcat Version

Head over to the official Apache Tomcat 9 download page and grab the tar.gz package for your target version (9.0.105, 9.0.109, or the latest stable 9.x release). You can either transfer the file to your server via SCP, or use wget directly with the download link:

# Replace [DIRECT_DOWNLOAD_LINK] with the actual link from the Apache website
sudo wget [DIRECT_DOWNLOAD_LINK]

3. Extract the New Tomcat Package

Unpack the downloaded tar.gz file in your current directory:

# Replace [TARGET_VERSION] with your chosen version (e.g., 9.0.109)
sudo tar -xzf apache-tomcat-[TARGET_VERSION].tar.gz

4. Replace the Old Tomcat Installation

  • Rename your existing Tomcat directory to keep it as a fallback:
    sudo mv /usr/local/tomcat /usr/local/tomcat-old
    
  • Move the new Tomcat directory to the standard installation path:
    sudo mv apache-tomcat-[TARGET_VERSION] /usr/local/tomcat
    

5. Migrate Your Custom Configurations & Applications

Don’t just copy everything blindly—we want to keep your custom settings but use the new default configs where possible.

  • Copy your critical custom files from the old installation:
    # Copy configuration files (server.xml, web.xml, context.xml, etc.)
    sudo cp -r /usr/local/tomcat-old/conf/* /usr/local/tomcat/conf/
    
    # Copy your deployed web applications (war files or expanded directories)
    sudo cp -r /usr/local/tomcat-old/webapps/* /usr/local/tomcat/webapps/
    
    # If you have custom libraries in lib/ (not default Tomcat libs), copy those too
    sudo cp /usr/local/tomcat-old/lib/*.jar /usr/local/tomcat/lib/
    
  • Important: Compare the new default config files with your old ones to catch any changes. For example, check server.xml for port configurations or web.xml for security updates:
    sudo diff /usr/local/tomcat-old/conf/server.xml /usr/local/tomcat/conf/server.xml
    
    Merge any critical updates from the new config into your custom version (don’t just overwrite the new files entirely).

6. Set Correct Permissions

Ensure the Tomcat user has full ownership of the new directory:

sudo chown -R tomcat:tomcat /usr/local/tomcat
sudo chmod +x /usr/local/tomcat/bin/*.sh

7. Start Tomcat & Verify the Upgrade

  • Start the Tomcat service:
    # Systemd method
    sudo systemctl start tomcat
    
    # Direct script method
    sudo /usr/local/tomcat/bin/startup.sh
    
  • Check the logs to confirm successful startup:
    sudo tail -f /usr/local/tomcat/logs/catalina.out
    
    Look for lines like Server startup in X ms—that means it’s running without issues.
  • Verify the version by accessing the Tomcat homepage (replace your-server-ip with your actual server IP):
    curl -s http://your-server-ip:8080 | grep "Apache Tomcat"
    
    You should see your target version listed here.
  • Test your web applications thoroughly to make sure they’re working as expected.

8. Rollback Plan (Just in Case)

If something breaks, revert to the old version quickly:

  1. Stop the new Tomcat service:
    sudo systemctl stop tomcat
    
  2. Remove the new directory and restore the old one:
    sudo rm -rf /usr/local/tomcat
    sudo mv /usr/local/tomcat-old /usr/local/tomcat
    
  3. Start the old Tomcat service:
    sudo systemctl start tomcat
    

内容的提问来源于stack exchange,提问作者AKASH BHAT

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.27 12:27:32