Tutorials

Install Apache Tomcat in Kali Linux – Tutorial 2018

In this tutorial, we’ll show you how to install Apache Tomcat 8.5.32 on Kali Linux. Apache Tomcat which is an open source Java Servlet implementation developed by Apache Software Foundation and used by many big companies around the globe. Tomcat supports various Java Server Technologies like JSP (Java Server Pages), Java Expression Language and Java WebSocket.

The Tomcat consists of the following components:

  • Catalina: It is the Servlet Container of Tomcat
  • Coyote: Coyote acts as a connector and supports HTTP 1.1
  • Jasper: It is the Tomcat’s JSP Engine
  • Cluster: A component for load balancing to manage the large applications
  • High availability: A Tomcat component to schedule system upgrades and changes without affecting live environment
  • Web Application: Manage Sessions, Support deployment across different environments

Prerequisites – 

  1. Kali Linux (32-bit/64-bit)
  2. Tomcat Package

Before installing Tomcat developers need to make sure that they have the latest version of Java Development Kit (JDK) installed and configured on the system. It is preferred to use Oracle Java.

To carry out this installation, developers need to install the latest Oracle Java (JDK) on Kali Linux. You can also verify the version of Java by typing the following command:

Command: java -version

In first step, create a directory under /opt with name tomcat by typing “mkdir /opt/tomcat

This will be the directory where we’ll download and extract all the files of Apache Tomcat package.

Now run the following command to download the zip file of Apache Tomcat 8.5.32 version under /opt/tomcat directory:

Command: wget http://redrockdigimark.com/apachemirror/tomcat/tomcat-8/v8.5.32/bin/apache-tomcat-8.5.32.zip

The download will take some time depending upon the network speed.

Next, Extract the tomcat zip file by typing “unzip apache-tomcat-8.5.32.zip” as shown below:

Now make the Linux scripts that is under apache-tomcat-8.5.32/bin/ executable and then create a symbolic link of startup and shutdown script for the Tomcat.

To change the permission, type

Command: cd apache-tomcat-8.5.32/bin/
Command:
chmod 700 *.sh
Command: ls -l

Now its time to create the symbolic link with the help of ln -s command of startup and shutdown script so that tomcat can easily be start and stop by just a single command.

For Startup Script, the command is:

Command: ln -s /opt/tomcat/apache-tomcat-8.5.32/bin/startup.sh /usr/bin/tomcatstart

For Shutdown Script, the command is:

Command: ln -s /opt/tomcat/apache-tomcat-8.5.32/bin/shutdown.sh /usr/bin/tomcatstop

Now to start Tomcat, you just need to fire the below command as root from anywhere in the shell.

Command: tomcatstart

As soon as you run the above command, your tomcat server will start on port 8080 which you can easily browse localhost:8080 in any browser as shown below:

To stop the tomcat server, you just need to type tomcatstop  in same terminal which immediately stops your tomcat server.

By default, the Tomcat page is accessed by the developers only due to its security implementation so that unauthorized users don’t have access to it. To access Admin and other sections like Server Status, App. Manager and Host Manager, developers need to add the user accounts for administrators and managers.

To do this, open tomcat-users.xml file which is located at /opt/tomcat/apache-tomcat-8.5.32/conf/ directory and append the following piece of code before </tomcat-users> line.

<role rolename=”manager-gui”/>
<role rolename=”admin-gui” />
<user username=”admin” password=”admin” roles=”manager-gui,admin-gui”/>

Now you’ll be able to access the Manager Page which looks like the below screenshot but make sure that you must stop and restart the tomcat server.

Furthermore, if you want it to access the web manager panel remotely then open context.xml file located at /opt/tomcat/apache-tomcat-8.5.32/webapps/manager/META-INF/ and comment the following piece of code as shown below:

And same can be done for host-manager too which is located at /opt/tomcat/apache-tomcat-8.5.32/webapps/host-manager/META-INF/context.xml

Now you can easily run your Manager GUI Panel from any remote location.

Furthermore, you can also change the Tomcat Server Port Number (default 8080) by editing /opt/tomcat/apache-tomcat-8.5.32/conf/server.xml file as shown below (Line No 69):

After changing the Tomcat Port to (anyport i.e. 1337), restart your Tomcat Service again and point the browser to http://localhost:1337/.

Congratulations! You have successfully completed all the settings and the basic configuration of Tomcat.

Have something to say about this article? Comment below or share it with us on Facebook or Twitter.

Yeahhub.com
Step by step hacking tutorials about wireless cracking, kali linux, metasploit, ethical hacking, seo tips and tricks, malware analysis and scanning.
https://www.yeahhub.com/

Leave a Reply

Your email address will not be published. Required fields are marked *

nineteen − seven =