DevOps Classroom notes 13/Aug/2025

Ansible contd..

Installing tomcat 10 on redhat 10

  1. Install Java
    Tomcat requires Java to run. You can install OpenJDK on RHEL 10 with:
    sudo dnf install java-17-openjdk-devel -y
    Verify the installation with:
    java -version
  2. Create a Tomcat User
    For security, create a non-root user to run Tomcat:
    sudo useradd -r -m -U -d /opt/tomcat -s /bin/false tomcat
  3. Download Apache Tomcat 10
    Download the latest Tomcat 10 tar.gz from the official Apache site. For example:
    sudo curl -O https://dlcdn.apache.org/tomcat/tomcat-10/v10.0.23/bin/apache-tomcat-10.0.23.tar.gz
    (Check the latest version on Apache’s official download page.)
  4. Extract and install Tomcat
    Create the install directory and extract files:
    sudo mkdir /opt/tomcat
    sudo tar -xvzf apache-tomcat-10.0.23.tar.gz -C /opt/tomcat --strip-components=1
  5. Set permissions
    Assign ownership to the tomcat user:
    sudo chown -R tomcat: /opt/tomcat
    sudo chmod -R u+x /opt/tomcat/bin
  6. Create a systemd Service
    Create a systemd service file /etc/systemd/system/tomcat.service with contents to manage Tomcat as a service. An example service file content:

“`
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target

[Service]
Type=forking

User=tomcat
Group=tomcat

Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk"
Environment="CATALINA_PID=/opt/tomcat/temp/tomcat.pid"
Environment="CATALINA_HOME=/opt/tomcat"
Environment="CATALINA_BASE=/opt/tomcat"
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
Environment="JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

Restart=on-failure

[Install]
WantedBy=multi-user.target
“`

  1. Start and enable Tomcat
    Reload systemd, start Tomcat and enable at boot:
    sudo systemctl daemon-reload
    sudo systemctl start tomcat
    sudo systemctl enable tomcat
  2. Configure firewall (if using firewall)
    Allow default HTTP port 8080:
    sudo firewall-cmd --permanent --add-port=8080/tcp
    sudo firewall-cmd --reload

This procedure manually installs Tomcat 10 on RHEL 10, as official support or packages might not yet be fully integrated into RHEL 10 repositories. This approach aligns with practices for RHEL 8/9 and other Fedora-based systems.[1][3][5][6][8]

If you want, I can provide the exact systemd service file content or help with configuring Tomcat users and roles for your use case. Let me know!

[1] https://www.ubuntumint.com/install-apache-tomcat-rhel-9/
[2] https://www.hostmycode.in/tutorials/how-to-install-apache-tomcat-10-on-ubuntu
[3] https://www.ubuntumint.com/install-apache-tomcat-rhel-8/
[4] https://utho.com/docs/linux/ubuntu/how-to-install-tomcat-on-ubuntu/
[5] https://maggiminutes.com/latest-apache-tomcat-installation/
[6] https://oracle-base.com/articles/linux/apache-tomcat-10-installation-on-linux
[7] https://www.digitalocean.com/community/tutorials/install-tomcat-on-linux
[8] https://access.redhat.com/solutions/661403
[9] https://tomcat.apache.org/download-10.cgi
[10] https://access.redhat.com/solutions/5826391

Implementation

  • Lets try to reuse the same playbook for both redhat and ubuntu.
  • Refer Here for the changes done
  • we are experiencing the service failure in redhat
  • to be fixed in next session
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%