X

How To Install Java And Tomcat On Ubuntu Gnome 16.04

Ubuntu Gnome is an open-source software. It can be used various purposes such as server and desktop version. I have to configure Java (8.0.144) and Tomcat (8.0.46) on your desktop version.  If you can use Apache Tomcat on your Gnome desktop then follow thus step by step my guides.

How To Configure Static IP address On Ubuntu 18.04
How To Create Custom Boot Partition On Ubuntu 16.04 Server

At first download Java (8.0.144) and Apache Tomcat (8.0.46)

Configure Java (8.0.144) on your Gnome desktop


Step #01: Create some directory for install Java.

root@tech-ubuntu:~# mkdir -p /home/local/app/java/jdk/

Then upload all java downloaded file on your jdk directory with version name.

Step #02: Select update alternative path for installation Java and Tomcat.

root@tech-ubuntu:~# update-alternatives --install "/usr/bin/javac" "javac" "/home/local/app/java/jdk/8.0.144/bin/javac" 1
root@tech-ubuntu:~# update-alternatives --install "/usr/bin/java" "java" "/home/local/app/java/jdk/8.0.144/bin/java" 1
root@tech-ubuntu:~# update-alternatives --set "javac" "/home/local/app/java/jdk/8.0.144/bin/javac"
root@tech-ubuntu:~# update-alternatives --set "java" "/home/local/app/java/jdk/8.0.144/bin/java"

Step #03: Create Java Home profile. Open profile file with any editor vi /etc/profile and then insert below line.

JRE_HOME=/home/local/app/java/jdk/8.0.144
PATH=$PATH:$JRE_HOME/bin
export JRE_HOME
export PATH

Configure Tomcat (8.0.46) on your Gnome desktop


Step #04: Again create tomcat directory

root@tech-ubuntu:~# mkdir -p /home/local/app/tomcat/

Then upload all downloaded file into tomcat folder with version name.

Step #05: Edit catalina.sh file for setup heap memory on your tomcat bin directory.

root@tech-ubuntu:~# vim /home/local/app/tomcat/8.0.46/bin/catalina.sh

Then insert below line

JAVA_OPTS="-Dfile.encoding=UTF-8 -server -Xms1024m -Xmx2048m -XX:PermSize=64m -XX:MaxPermSize=256m -Djava.awt.headless=true -XX:+UseParallelGC -XX:MaxGCPauseMillis=100"

Sate and exit.

Step #06: Now create Tomcat service file for start and stop. Open vim /etc/init.d/tomcat and insert all below lines on your tomcat file.

#!/bin/bash
### BEGIN INIT INFO
# Provides:tomcat8
# Required-Start:  $network
# Required-Stop:   $network
# Default-Start:   2 3 4 5
# Default-Stop:    0 1 6
# Short-Description: Start/Stop Tomcat server
### END INIT INFO

JAVA_HOME=/home/local/app/java/jdk/8.0.144
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/home/local/app/tomcat/8.0.46
case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac
exit 0

Step #07: Then create permission for execute Java and start Tomcat.

root@tech-ubuntu:~# chmod 755 /etc/init.d/tomcat
root@tech-ubuntu:~# chmod -R 755 /home/local/app/
root@tech-ubuntu:~# /etc/init.d/tomcat start

Finally goto your browser and type http://localhost:8080/ press enter or http://Your_server_ip:8080/

If face any problem then see my YouTube video and Subscribe my channel. Please subscribe my channel for more update.

0 0 votes
Article Rating
Admin: I am system administrator as Windows and Linux platform. I have 4 years skilled from the professional period. I have to configure Linux based system such as an Asterisk VOIP system, Network monitoring tools (ZABBIX), Virtualization (XEN Server), Cloud computing (Apache CloudStack) etc. Now share my professional skill each interested person. Thanks to all.
Leave a Comment