Below steps for installing tomcat in oracle
1.Pre-req: Install Java 8
For Apache Tomcat 9 to be installed and configured properly, you need to have Java version 8 installed on your system.
To verify the java version on your system, execute the following.
$ java -version
java version “1.8.0_131”
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
If you don’t have Java JRE 8 installed, then follow these steps: How to Install Java 8 JRE on Linux
Create tomcat User
First, as root, create a user called tomcat and assign a password as shown below.
2.Create new OS User for tomcat
adduser tomcat
passwd tomcat
Next, su to this newly created tomcat user.
3.Download the latest tomact
su – tomcat
Download Apache Tomcat 9
Go to Apache Tomcat 9 Download page.
Under Core, click on “tar.gz” link to download the tar.gz version of the latest tomcat.
In this example, we are downloading this file: apache-tomcat-9.0.0.M21.tar.gz
4.Install Apache Tomcat
First, untar the tar.gz file as shown below using tar command
tar xvfz apache-tomcat-9.0.0.M21.tar.gz
This will create a directory apache-tomcat with the version number in it. cd to this new directory.
cd apache-tomcat-9.0.0.M21
Apache Tomcat 9 Directories
You’ll see the following files and directories under this apache-tomcat directory.
$ ls -altr
drwxr-x—. 2 tomcat tomcat 6 May 4 22:42 work
drwxr-x—. 2 tomcat tomcat 6 May 4 22:42 logs
drwxr-x—. 7 tomcat tomcat 76 May 4 22:43 webapps
-rw-r—–. 1 tomcat tomcat 15946 May 4 22:45 RUNNING.txt
-rw-r—–. 1 tomcat tomcat 6709 May 4 22:45 RELEASE-NOTES
-rw-r—–. 1 tomcat tomcat 1804 May 4 22:45 NOTICE
-rw-r—–. 1 tomcat tomcat 57092 May 4 22:45 LICENSE
drwx——. 2 tomcat tomcat 4096 May 4 22:45 conf
drwxr-x—. 2 tomcat tomcat 29 Jun 1 17:25 temp
drwxr-x—. 2 tomcat tomcat 4096 Jun 1 17:25 lib
drwxr-x—. 2 tomcat tomcat 4096 Jun 1 17:25 bin
5.Set Apache Tomcat CATALINA_HOME
The home environment variable that is used inside the Apache tomcat script is called as CATALINA_HOME.
Catalina refers to Tomcat.
Set this variable to the full directory of the apache tomcat that we extracted earlier as shown below.
export CATALINA_HOME=/home/tomcat/apache-tomcat-9.0.0.M21
Apart from setting it on the command line, make sure you add the above line to tomcat’s bash_profile also as shown below. This will make sure this variable is set every time you login as tomcat user.
$ vi ~/.bash_profile
export CATALINA_HOME=/home/tomcat/apache-tomcat-9.0.0.M21
Log-out and login as tomcat user to verify that this environment variable is set properly.