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



No comments:

Post a Comment