Monday, August 5, 2019

Setup Tomcat8 on Red Hat Enterprise Linux 8 - How to install Tomcat 8 on Red Hat 8

Welcome to setting up Tomcat 8 on RedHat Linux 8.

Please find below steps for setting up Tomcat 8 on RHEL 8.

update package

sudo yum update

Install wget
sudo yum install wget -y
sudo yum install unzip -y

Java Installation

Download Java from Oracle site.

sudo wget --no-check-certificate --no-cookies --header 'Cookie: oraclelicense=accept-securebackup-cookie' 'http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.rpm'

Install from RPM
sudo  rpm -i jdk-8u141-linux-x64.rpm

java -version

make sure Java version appearing fine.

Tomcat Installation

cd /opt

sudo wget http://apache.osuosl.org/tomcat/tomcat-8/v8.5.43/bin/apache-tomcat-8.5.43.zip

unzip Tomcat

sudo unzip apache-tomcat-8.5.43.zip

create a symbolic link 
sudo ln -s /opt/apache-tomcat-8.5.43 /opt/tomcat

Create user for tomcat

Create a user for running tomcat and give required permissions.
sudo useradd tomcat
sudo chown -R tomcat:tomcat /opt/apache-tomcat-8.5.43
sudo chmod +x /opt/tomcat/bin/*.sh

Create tomcat 8 as a service

sudo vi /etc/systemd/system/tomcat.service

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

[Service]
Type=forking

User=tomcat
Group=tomcat

ExecStart=/opt/tomcat/bin/catalina.sh start
ExecStop=/opt/tomcat/bin/catalina.sh stop

[Install]
WantedBy=multi-user.target

Re-load systemd

sudo systemctl daemon-reload

Restart Tomcat8 as a service

sudo systemctl start tomcat

Verify Tomcat service is running
sudo systemctl status tomcat

Enable as a service

sudo systemctl enable tomcat



9 comments:

  1. Replies
    1. The step-by-step approach makes setting up Tomcat 8 on Red Hat Enterprise Linux much easier to understand, especially for someone working through the complete server configuration for the first time. The article covers the important sequence from updating packages and installing Java to downloading Tomcat, creating the required user, setting permissions, and preparing Tomcat as a systemd service.

      The Java installation followed by Tomcat configuration is particularly relevant for anyone exploring a Java Full Stack Course, because deploying Java applications requires understanding the environment in which the application server runs. The use of catalina.sh, a dedicated Tomcat user, and the /opt/tomcat symbolic link also gives the setup a practical server-administration perspective.

      Delete
    2. I also found the systemd configuration useful because it shows how Tomcat can be managed like a regular Linux service using systemctl start, status, and enable. These deployment and server-side concepts complement the application-development side of a Web Development Course, particularly when moving from developing a web application to hosting and running it on a Linux server.

      Delete