AMP AMP

How to Install Apache Tomcat 9.0.21 Version on CentOS 7.6

Installation of Apache Tomcat 9.0.21

Pre-requisistes:

Java -12

Download link :

http://mirrors.estointernet.in/apache/tomcat/tomcat-9/v9.0.21/bin/apache-tomcat-9.0.21.zip

Installation Procedure:

Change the directory to the localdirectory under /usr

[root@linuxhelp ~]# cd /usr/local

Download the Apache tomcat 9 using wget as follows:

[root@linuxhelp local]# wget http://mirrors.estointernet.in/apache/tomcat/tomcat-9/v9.0.21/bin/apache-tomcat-9.0.21.zip
--2019-06-18 01:33:20--  http://mirrors.estointernet.in/apache/tomcat/tomcat-9/v9.0.21/bin/apache-tomcat-9.0.21.zip
Resolving mirrors.estointernet.in (mirrors.estointernet.in)... 103.123.234.254, 2403:8940:ffff::f
Connecting to mirrors.estointernet.in (mirrors.estointernet.in)|103.123.234.254|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11478988 (11M) [application/zip]
Saving to: ‘apache-tomcat-9.0.21.zip’

100%[====================================================================================================>] 11,478,988   925KB/s   in 12s    

2019-06-18 01:33:32 (897 KB/s) - ‘apache-tomcat-9.0.21.zip’ saved [11478988/11478988]

List the content to view the zip file of apache tomcat 9

[root@linuxhelp local]# ll
total 11212
-rw-r--r--  1 root root 11478988 Jun  5 02:18 apache-tomcat-9.0.21.zip
drwxr-xr-x. 2 root root       22 Jun 18 00:46 bin
drwxr-xr-x. 2 root root        6 Apr 11  2018 etc
drwxr-xr-x. 2 root root        6 Apr 11  2018 games
drwxr-xr-x. 2 root root        6 Apr 11  2018 include
drwxr-xr-x. 2 root root        6 Apr 11  2018 lib
drwxr-xr-x. 2 root root        6 Apr 11  2018 lib64
drwxr-xr-x. 2 root root        6 Apr 11  2018 libexec
drwxr-xr-x. 2 root root        6 Apr 11  2018 sbin
drwxr-xr-x. 5 root root       49 Apr 11  2018 share
drwxr-xr-x. 2 root root        6 Apr 11  2018 src

Extract the downloaded zip file of tomcat apache 9

[root@linuxhelp local]# unzip apache-tomcat-9.0.21.zip
Archive:  apache-tomcat-9.0.21.zip
   creating: apache-tomcat-9.0.21/
   creating: apache-tomcat-9.0.21/bin/
   creating: apache-tomcat-9.0.21/conf/
   creating: apache-tomcat-9.0.21/lib/
   creating: apache-tomcat-9.0.21/logs/
   creating: apache-tomcat-9.0.21/temp/
   creating: apache-tomcat-9.0.21/webapps/
   creating: apache-tomcat-9.0.21/webapps/ROOT/
   creating: apache-tomcat-9.0.21/webapps/ROOT/WEB-INF/
   creating: apache-tomcat-9.0.21/webapps/docs/
   creating: apache-tomcat-9.0.21/webapps/docs/WEB-INF/
.
.
.
.
.
.
inflating: apache-tomcat-9.0.21/webapps/manager/WEB-INF/jsp/connectorCiphers.jsp  
  inflating: apache-tomcat-9.0.21/webapps/manager/WEB-INF/jsp/connectorTrustedCerts.jsp  
  inflating: apache-tomcat-9.0.21/webapps/manager/WEB-INF/jsp/sessionDetail.jsp  
  inflating: apache-tomcat-9.0.21/webapps/manager/WEB-INF/jsp/sessionsList.jsp  
  inflating: apache-tomcat-9.0.21/webapps/manager/WEB-INF/web.xml  
  inflating: apache-tomcat-9.0.21/webapps/manager/images/asf-logo.svg  
  inflating: apache-tomcat-9.0.21/webapps/manager/images/tomcat.gif  
  inflating: apache-tomcat-9.0.21/webapps/manager/index.jsp  
  inflating: apache-tomcat-9.0.21/webapps/manager/status.xsd  
  inflating: apache-tomcat-9.0.21/webapps/manager/xform.xsl  

List the contents to view the extracted directory.

[root@linuxhelp local]# ll
total 11212
drwxr-xr-x  9 root root      220 Jun  4 21:23 apache-tomcat-9.0.21
-rw-r--r--  1 root root 11478988 Jun  5 02:18 apache-tomcat-9.0.21.zip
drwxr-xr-x. 2 root root       22 Jun 18 00:46 bin
drwxr-xr-x. 2 root root        6 Apr 11  2018 etc
drwxr-xr-x. 2 root root        6 Apr 11  2018 games
drwxr-xr-x. 2 root root        6 Apr 11  2018 include
drwxr-xr-x. 2 root root        6 Apr 11  2018 lib
drwxr-xr-x. 2 root root        6 Apr 11  2018 lib64
drwxr-xr-x. 2 root root        6 Apr 11  2018 libexec
drwxr-xr-x. 2 root root        6 Apr 11  2018 sbin
drwxr-xr-x. 5 root root       49 Apr 11  2018 share
drwxr-xr-x. 2 root root        6 Apr 11  2018 src

Rename the extracted directory to tomcat9

[root@linuxhelp local]# mv apache-tomcat-9.0.21 tomcat9

Setup a environment variable for the tomcat 9 in the following location.

[root@linuxhelp local]# echo "export CATALINA_HOME="/usr/local/tomcat9"" >> ~/.bashrc

Reload the variables

[root@linuxhelp local]# source ~/.bashrc

Change the directory to bin

[root@linuxhelp local]# cd tomcat9/bin

List the contents in the bin directory

[root@linuxhelp bin]# ll
total 864
-rw-r--r-- 1 root root  35064 Jun  4 21:21 bootstrap.jar
-rw-r--r-- 1 root root  15900 Jun  4 21:21 catalina.bat
-rw-r--r-- 1 root root  23447 Jun  4 21:21 catalina.sh
-rw-r--r-- 1 root root   1703 Jun  4 21:21 catalina-tasks.xml
-rw-r--r-- 1 root root   2123 Jun  4 21:21 ciphers.bat
-rw-r--r-- 1 root root   1997 Jun  4 21:21 ciphers.sh
-rw-r--r-- 1 root root  25145 Jun  4 21:21 commons-daemon.jar
-rw-r--r-- 1 root root 207125 Jun  4 21:21 commons-daemon-native.tar.gz
-rw-r--r-- 1 root root   2040 Jun  4 21:21 configtest.bat
-rw-r--r-- 1 root root   1922 Jun  4 21:21 configtest.sh
-rw-r--r-- 1 root root   8513 Jun  4 21:21 daemon.sh
-rw-r--r-- 1 root root   2091 Jun  4 21:21 digest.bat
-rw-r--r-- 1 root root   1965 Jun  4 21:21 digest.sh
-rw-r--r-- 1 root root   3606 Jun  4 21:21 makebase.bat
-rw-r--r-- 1 root root   3382 Jun  4 21:21 makebase.sh
-rw-r--r-- 1 root root   3460 Jun  4 21:21 setclasspath.bat
-rw-r--r-- 1 root root   3708 Jun  4 21:21 setclasspath.sh
-rw-r--r-- 1 root root   2020 Jun  4 21:21 shutdown.bat
-rw-r--r-- 1 root root   1902 Jun  4 21:21 shutdown.sh
-rw-r--r-- 1 root root   2022 Jun  4 21:21 startup.bat
-rw-r--r-- 1 root root   1904 Jun  4 21:21 startup.sh
-rw-r--r-- 1 root root  47880 Jun  4 21:21 tomcat-juli.jar
-rw-r--r-- 1 root root 418909 Jun  4 21:21 tomcat-native.tar.gz
-rw-r--r-- 1 root root   4574 Jun  4 21:21 tool-wrapper.bat
-rw-r--r-- 1 root root   5515 Jun  4 21:21 tool-wrapper.sh
-rw-r--r-- 1 root root   2026 Jun  4 21:21 version.bat
-rw-r--r-- 1 root root   1908 Jun  4 21:21 version.sh

Assign the writable permissions to the startup.sh and cataline.sh

[root@linuxhelp bin]# chmod -R 777 startup.sh
[root@linuxhelp bin]# chmod -R 777 catalina.sh

Run the startup script

[root@linuxhelp bin]# ./startup.sh
Using CATALINA_BASE:   /usr/local/tomcat9
Using CATALINA_HOME:   /usr/local/tomcat9
Using CATALINA_TMPDIR: /usr/local/tomcat9/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat9/bin/bootstrap.jar:/usr/local/tomcat9/bin/tomcat-juli.jar
Tomcat started.

Verify the port number 8080

[root@linuxhelp bin]# netstat -tulpn | grep 8080
tcp6       0      0 :::8080                 :::*                    LISTEN      10829/java          

Open the browser and enter the server_name followed by port number to verify the installation of apache tomcat 9.

With this,Installation of Apache tomcat 9.0.21 Using LEMP On CentOS 7.6 comes to end.

FAQ
Q
Is JSP a server-side Scripting language in apache tomcat?
A
Yes, JSP is a server-side Scripting language in apache tomcat.
Q
Why do we need JSP's in apache tomcat?
A
We need JSP's which is easy to code and to read in apache tomcat
Q
What is the main purpose of Java servlets in apache tomcat?
A
The main purpose of the java servlets is for sending content to a client which generates dynamic content on the web in apache tomcat.
Q
What does java servlets do in apache tomcat?
A
A java servlet is a java software component that extends the capabilities of a server in apache tomcat.
Q
What is the use of apache tomcat ?
A
Apache tomcat is used to deploy Java Servelets and JSP's