Tuesday, July 6, 2021

Why and How to install/update tomcat 9 in Linux

 

** This is applicable in Linux environment (red hat , Centos , Amazon linux ..etc) .

 Why ?

Tomcat will allow you to run a web server and Servlet container. So, if you have an application needs to run in this platform and a free web server needed , you will go to install tomcat as a most common in this matter.

How ?

Below are most brief commands you may need to use in install tomcat 9 in Redhat / Centos 7 & 8  :

1- download tomcat files from tomcat website (you may use “wget” if interned open in server) and upload it to your server and create a tomcat service user as below:

groupadd -g 53 -r tomcat

useradd -c "tomcat" -u 53 -g tomcat -s /bin/sh -r tomcat

 2- unzip/untar the file to your installation path, I will use
(/app/tomcat) and setup permissions:

mkdir -p /app/tomcat

tar -xf apache-tomcat-9.0.40.tar.gz -C /app/tomcat

chown -R tomcat:tomcat /app/tomcat/

chmod -R u+X /app/tomcat/

3- Check/Install and configured whether java 11 or java 8

java -version

yum install java-11-openjdk

alternatives --config java

4- Create systemd service to manage tomcat9 (sample configuraiont)

 vim /etc/systemd/system/tomcat9.service

[Unit]

Description=Tomcat 9 servlet container

After=network.target

[Service]

Type=forking

User=tomcat

Group=tomcat

Environment="JAVA_HOME=/usr/lib/jvm/jre"

# you may need to set below if application use the below

# import java.security.SecureRandom;

Environment="JAVA_OPTS=-Djava.security.egd=file:/dev/./urandom"

Environment="CATALINA_BASE=/app/tomcat"

Environment="CATALINA_HOME=/app/tomcat"

Environment="CATALINA_PID=/app/tomcat/temp/tomcat.pid"

Environment="CATALINA_OPTS=-Xms512M -Xmx2048M -server -XX:+UseParallelGC"

ExecStart=/app/tomcat/bin/startup.sh

ExecStop=/app/tomcat/bin/shutdown.sh

[Install]

WantedBy=multi-user.target

---------

systemctl daemon-reload

systemctl enable --now tomcat9

5- configure your tomcat 9 :

/app/tomcat/conf (server.xml , web.xml ..etc)

/app/tomcat/webapps # (put your application files)

systemctl restart tomcat9.service

systemctl status tomcat9.service

Why and How to install Grid 19c on RHEL 8?

  Why ? Simply we will be requested to install Oracle Grid RAC DB on Redhat RHEL 8, below is my note for this installation . How ? 1-  OS in...