The current Apache Tomcat 9.0.50 release is available. This tutorial will guide you through step by step installation of the Apache Tomcat server on Debian. Let’s follow to Install Apache Tomcat 9 on Debian 10/9/8.
Step 1 – Prerequisites
You must have root user or sudo privileged user access to install Tomcat on the Debian system. Login to your Debian system with shell access. Use SSH to get access to the remote Linux system. Now update the apt package manager cache and upgrade the current packages of the system.
Step 2 – Install Java
You must have Java installed on the system before installing Apache Tomcat on a Linux VPS. Tomcat 9 required Java 8 or later versions to work. If you don’t have Java installed on your system or installed a lower version, Use this tutorial to install Java 8 on a Debian machine.
Step 3 – Install Apache Tomcat 9 on Debian
You need to download the Tomcat archive from its official download website or mirrors. Download Apache Tomcat 9 archive file using following commands or you can visit Tomcat 9 official download page for download most recent available version.
Step 4 – Configure Tomcat on Debian
Configure the required environment variables for the Tomcat. Set CATALINA_HOME to the extracted tomcat directory. Also, set Java environment variables as per Java installed on your system. Set all these variables in a file /etc/profile.d/tomcat9.sh. This file will automatically load variables after system reboot. To load in current environment run command:
Step 5 – Setup Tomcat User Accounts
Y need to create user accounts to secure and access admin/manager pages. Edit conf/tomcat-users.xml file in your editor and paste inside
Step 6 – Enable Host/Manager for Remote IP
The default manager and host-manager web pages are enabled to access from localhost only. To access these pages from the remote system, you have to allow your IP or IP range in the application-specific context.xml file. Manager File: ./webapps/manager/META-INF/context.xml Host Manager File: ./webapps/host-manager/META-INF/context.xml Edit the above files and add your IP address like the screenshot. After making changes restart the Tomcat service.
Step 7 – Start Tomcat Service
Tomcat is very easy to use, There is no need to compile its source. You simply extract the archive and start the tomcat server. Tomcat by default start on port 8080, So make sure no other application using the same port. [Sample Output] Use below command to stop tomcat server on your system.
Step 8 – Access Tomcat in Browser
Tomcat service uses default port 8080. Open your favorite web browser and connect to your server on port 8080. This will provide access to the Tomcat setup on your system. Access Tomcat Home- This is default home screen of tomcat 9. There are no authentication required to access this page..
Access Manager App- Click on Manager App link displayed on home page.This page is allowed for Admin and Manager access both.
Access Host Manager Page:- Click on the Host Manager link on your Tomcat home.This page is allowed for Admin access only.