Installing Tomcat on Ubuntu Version 16.04
If you are using Java Hosting plans from HostingRaja, here you will get a detail information about to install Tomcat on Ubuntu version 16.04 follow the below-mentioned steps:
1)Update your system:
You need to have the latest version of Ubuntu 16.04 and use the command:
sudo apt-get update
Install Java and use the command:
sudo apt-get install default-jdk
2) You need to update the JAVA_HOME variable:
Find the directory for JAVA_HOME and use the command:
update-alternatives --config java
Copy the directory and type the following:
It will open up with the file that consists of environment variables
The path which are in quotes is the path which you are using and then Save and close the file.
Reload the environment variables to take the effect.
You need to make sure that it has worked properly:
And you will be able to see the path you've entered.
3)Create the user to run the Tomcat web server
Let us assume the user as 'abcd'.
useradd -s /bin/false -g abcd -d /opt/abcd abcd
And you have to make sure that you know the version of Tomcat that you need to install
You need to make a directory for the Tomcat files:
Download the Tomcat
You need to Unzip the files into the tomcat folder
tar xvf apache-tomcat-8*tar.gz -C /opt/tomcat --strip-components=1
You can also press the Tab key after typing the apache since you will be having only one download in your folder.
You need to also make sure that the folders have the right permissions.
sudo chown -R tomcat tomcat/
Display the JAVA_HOME path once again, so that you will be able to copy it
4) Configure the Tomcat
You need to copy and paste the settings below into the tomcat.service file that you have created. And Edit the JAVA_HOME path to the one that you have copied. Later you need to save and close the file.
Description=Apache Tomcat Web Application Container
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
And then Reload the SystemD daemon so the service settings which are added is been included.
sudo systemctl daemon-reload
Now you can start the Tomcat service.
sudo systemctl start tomcat
You need to check the status of your Tomcat server
sudo systemctl status tomcat
Browse to http://your-ip-address:2086
You will be able to see the Tomcat server landing page.