Apache Tomcat is an open source software which was supporting java, Servlet, JSP, EL & Java WebSocket technologies.
Apache Tomcat is developed by Apache Tomcat Project and maintained by Apache Software Foundation.
The latest version of Apache Tomcat 9.0.20 released on May 03, 2019.
Initially Apache Tomcat 9.0.0.M1 was release on Nov 17, 2015.
1) How To Install Java in Linux?
Java is mandatory to run Apache Tomcat, use the below command to check whether Java is installed on your system or not.
If no, Install OpenJDK or Oracle Java before proceeding Tomcat Installation.
# java -version
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
Yes, Java has been already installed in system. so, proceed to next step.
2) Downloading Apache Tomcat Archive file
Use the below command to download the stable release of Apache Tomcat 8.0.12 Archive file.
Use your preferred download utility to download the archive file. I prefer to go with wget utility.
# wget http://www.eu.apache.org/dist/tomcat/tomcat-8/v8.0.32/bin/apache-tomcat-8.0.32.tar.gz
Extract the tar archive file.
# tar -zxvf apache-tomcat-8.0.32.tar.gz
Go to the tomcat bin directory.
# cd /opt/apache-tomcat-8.0.32/bin
Finally start the tomcat instance.
# ./startup.sh Using CATALINA_BASE: /opt/apache-tomcat-8.0.32 Using CATALINA_HOME: /opt/apache-tomcat-8.0.32 Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.32/temp Using JRE_HOME: / Using CLASSPATH: /opt/apache-tomcat-8.0.32/bin/bootstrap.jar:/opt/apache-tomcat-8.0.32/bin/tomcat-juli.jar Tomcat started.
3) Access Apache Tomcat
Open your web browser and navigate to http://localhost:8080 or http://your-server-ip-address:8080 or http://127.0.0.1:8080 By default tomcat serving port number 8080.
4) How to access Server Status, Manager App & Host Manager?
If you want to access Server Status, Manager App & Host Manager in tomcat, you need to add manager-gui
and admin-gui
roles under conf/tomcat-users.xml
file.
- manager-gui : Control Server Status & Manager App
- admin-gui : Control Host Manager
You can access those things by adding a UserName
and password
to manager-gui and admin-gui roles (Use your username & password instead of us).
To do so, stop tomcat service
and add the below colored lines in your conf/tomcat-users.xml
file under tomcat-users
then save and exit, and finally start tomcat
service.
Run the following command to stop the tomcat service.
# cd /opt/apache-tomcat-8.0.32/bin # ./shutdown.sh
Add a user & password in tomcat-users.xml file.
# nano /opt/apache-tomcat-8.0.32/conf/tomcat-users.xml <role rolename="manager-gui"/> <user username="2g" password="2g" roles="manager-gui"/> <role rolename="admin-gui"/> <user username="2daygeek" password="2G$#123" roles="admin-gui"/>
Run the following command to start the tomcat service.
# cd /opt/apache-tomcat-8.0.32/bin # ./startup.sh
Open your web browser and navigate to http://localhost:8080 or http://your-server-ip-address:8080 or http://127.0.0.1:8080 and hit Server Status or Manager App button. It will ask you to enter username and its password.
Successfully launched the Server Status.
Open your web browser and navigate to http://localhost:8080 or http://your-server-ip-address:8080 or http://127.0.0.1:8080 and hit Host Manager button. It will ask you to enter username and its password.
Successfully launched the Host Manager.
We are preparing all articles in-depth to understand by all level/stage Linux administrators. If the article is useful for you, then please spend less than a minute to share your valuable comments in our commenting section.
Please stay tune with us…Good Luck.
Your tutorial works on CentOS 7, Thanks.
I also created a systemd unit file as described at https://www.rosehosting.com/blog/installing-tomcat-8-on-a-centos-7-linux-vps/ so I can start/stop/reload Tomcat like any other Linux service, which is very handy.
Thanks.
Toby