Zoyinc
  • Home
  • Contact
  • Categories
    • CD Archiving
    • GIMP
    • Linux
    • MythTV
    • Open Media Vault
    • Technology
    • VMware
    • WordPress
    • YouTube
  • About


Installing Tomcat 9 behind Apache on CentOS 7

By

Tony

,

September 15, 2019

There are a number of posts on how to do this. I have created this post mostly for my own records so I know I will continue to have a record of what I have done.

Setup

Ensure you have at least JDK 8, I have the RPM “java-1.8.0-openjdk.x86_64” installed by this point.

Create a system user account to run tomcat:

useradd -r tomcat –shell /bin/false

Download the Tomcat 9 zip file, in my case this was “apache-tomcat-9.0.22.zip” which I downloaded to “/var/tmp” and then extract it and set permissions:

cd /var/tmp
unzip apache-tomcat-9.0.22.zip -d /opt
mv /opt/apache-tomcat-9.0.22 /opt/tomcat9
chown -R tomcat.tomcat /opt/tomcat9

Now create a service file:

/etc/systemd/system/tomcat.service

For me this looked like:

[Unit]
Description=Apache Tomcat 9
After=syslog.target network.target

[Service]
User=tomcat
Group=tomcat
Type=forking
Environment=CATALINA_PID=/opt/tomcat9/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat9
Environment=CATALINA_BASE=/opt/tomcat9
ExecStart=/opt/tomcat9/bin/startup.sh
ExecStop=/opt/tomcat9/bin/shutdown.sh
Restart=on-failure

[Install]
WantedBy=multi-user.target

Now set the correct permissions for the Tomcat startup script, enable the service and finally start the service:

cd /opt/tomcat9/bin
chmod 774 *.sh
systemctl enable tomcat.service
systemctl start tomcat.service

At this point Tomcat is running and you should be able to access it on port 8080 so:

http://centos7-base:8080/

References

Rose Hosting: Install Tomcat 9 on CentOS 7
https://www.rosehosting.com/blog/install-tomcat-9-on-centos-7/

Red Hat: Creating and Modifying systemd Unit Files
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-unit_files

 

Related

Apache doesn’t write to /var/tmp
How to get the mod_jk connector for Apache
CentOS 7 + PHP 7.2 + Python 3.6 + Apache 2.4
CentOS 7 VM for WordPress and MythTV – Post install setup
Recent

  • AlmaLinux GUI – no taskbar or application shortcuts

    AlmaLinux GUI – no taskbar or application shortcuts

  • AlmaLinux 9.5 base VM

    AlmaLinux 9.5 base VM

  • Reset Kodi thumbnails

    Reset Kodi thumbnails

  • Set default settings values in Kodi skins

    Set default settings values in Kodi skins

  • Add/Remove/Reset music/video libraries in Kodi

    Add/Remove/Reset music/video libraries in Kodi

  • Zoyinc Kodi skin on Sony TV

    Zoyinc Kodi skin on Sony TV

  • [L] – WordPress UAM Locked Post

    [L] – WordPress UAM Locked Post

  • Import Pictures and Videos – images not previewed

    Import Pictures and Videos – images not previewed

  • Find My Train

    Find My Train

  • WordPress style name not visible

    WordPress style name not visible

About Zoyinc

  • Contact Us
  • Zoyinc Disclaimer
  • Google Search Console
  • Privacy Policy
  • Site Statistics
  • Login

Apache Auckland Backup CD CentOS Centos7 Children Configuration Debian Error ESX ESXi Fedora Firewall Install Josh Kids Kodi Linux MariaDB MySQL MythTV New Zealand OKD OMV Open Media Vault OpenShift PHP Player Python RAID RedHat Red Hat Rip School Setup SMB SonicWALL Spark tags Train Trains VLAN VM VMware Weaver Windows WordPress YouTube

Powered by

This site is licensed under a Creative Commons Attribution 4.0 International License.