• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to install and Configure Apache Tomcat 8.0.23

21

Steps to Install and Configure Apache Tomcat 8.0.23 in CentOS 7

Tomcat is an open-source web server and servlet container developed by Apache Software Foundation and is written primarily in Java, which is released under Apache License 2.0. In this article we will learn the process of installing Apache Tomcat 8 (i.e. 8.0.23) on Linux systems, which includes RHEL, CentOS, Fedora, Debian, Ubuntu, etc.

Components of Tomcat

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

Step 1:

To Install Java 8

Before installing Tomcat make sure you have the latest version of Java Development Kit (JDK) installed and configured on the system. It is preferred to use oracle Java.

Step 2:

To Download and Install Apache Tomcat 8

Once latest Java version is installed and configured, we will download and install latest stable version of Tomcat 8 (i.e. 8.0.23).

Next create a /opt/tomcat/ directory and download the latest version of Apache Tomcat 8 under this directory, also for cross checking the download file, download the hash file.

[root@linuxhelp Desktop]# mkdir /opt/tomcat/
[root@linuxhelp Desktop]# cd /opt/tomcat/
[root@linuxhelp tomcat]# ls -l
total 9428
-rwxrw-rw-. 1 root root 9651551 Apr  1 04:01 apache-tomcat-8.0.23.zip
[root@linuxhelp tomcat]# 

Replace the version number in the above download link with the latest version available if it is different.

Now verify the MD5 Checksum against the key.

[root@linuxhelp tomcat]# md5sum apache-tomcat-8.0.23.zip 
363375ec777e0d265403f1ec9a3d1011  apache-tomcat-8.0.23.zip
[root@linuxhelp tomcat]# 

Extract the Tomcat zip and cd to ‘ apache-tomcat-8.0.23/bin/‘ directory.

[root@linuxhelp tomcat]# unzip apache-tomcat-8.0.23.zip 
Archive:  apache-tomcat-8.0.23.zip
   creating: apache-tomcat-8.0.23/
   creating: apache-tomcat-8.0.23/bin/
   creating: apache-tomcat-8.0.23/conf/
   creating: apache-tomcat-8.0.23/lib/
   creating: apache-tomcat-8.0.23/logs/
. . .
. . .
inflating: apache-tomcat-8.0.23/webapps/manager/images/void.gif  
  inflating: apache-tomcat-8.0.23/webapps/manager/index.jsp  
  inflating: apache-tomcat-8.0.23/webapps/manager/status.xsd  
  inflating: apache-tomcat-8.0.23/webapps/manager/xform.xsl  
[root@linuxhelp tomcat]# 
[root@linuxhelp tomcat]# cd apache-tomcat-8.0.23/bin

Now make the Linux scripts executable that is under ‘ apache-tomcat-8.0.23/bin/‘ and then create symbolic link of startup and shutdown script for tomcat as:

Change all scripts *.sh executable only for root as,

[root@linuxhelp bin]# chmod 700 /opt/tomcat/apache-tomcat-8.0.23/bin/*.sh

Create Symbolic link for startup script as, tomcatup

[root@linuxhelp bin]# ln -s /opt/tomcat/apache-tomcat-8.0.23/bin/startup.sh /usr/bin/tomcatup

Create Symbolic link for shutdown script as, tomcatdown

[root@linuxhelp bin]# ln -s /opt/tomcat/apache-tomcat-8.0.23/bin/shutdown.sh /usr/bin/tomcatdown

Now to start tomcat, run the below command as root from anywhere in the shell.

[root@linuxhelp bin]# tomcatup
Using CATALINA_BASE:   /opt/tomcat/apache-tomcat-8.0.23
Using CATALINA_HOME:   /opt/tomcat/apache-tomcat-8.0.23
Using CATALINA_TMPDIR: /opt/tomcat/apache-tomcat-8.0.23/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /opt/tomcat/apache-tomcat-8.0.23/bin/bootstrap.jar:/opt/tomcat/apache-tomcat-8.0.23/bin/tomcat-juli.jar
Tomcat started.

Once ‘ Tomcat Started‘ , you can point your browser to http://127.0.0.1:8080 and you should see something as below:

Apache tomcat

Step 3:

Changing Apache Tomcat Port

To change tomcat default port from the port 8080 to any other unused port (say 198), shutdown tomcat server by typing the below command from anywhere in the shell.

[root@linuxhelp bin]# tomcatdown
Using CATALINA_BASE:   /opt/tomcat/apache-tomcat-8.0.23
Using CATALINA_HOME:   /opt/tomcat/apache-tomcat-8.0.23
Using CATALINA_TMPDIR: /opt/tomcat/apache-tomcat-8.0.23/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /opt/tomcat/apache-tomcat-8.0.23/bin/bootstrap.jar:/opt/tomcat/apache-tomcat-8.0.23/bin/tomcat-juli.jar

Next, open the file using editor and edit it, here the path is ‘ /opt/tomcat/apache-tomcat-8.0.23/conf/server.xml‘ . Now change the default port 8080 to 198, save and exit.

[root@linuxhelp bin]# vim /opt/tomcat/apache-tomcat-8.0.23/conf/server.xml 

tomcat bin

After changing port to 198, then restart tomcat service again and point your browser to http://127.0.0.1:198.

[root@linuxhelp bin]# tomcatup
Using CATALINA_BASE:   /opt/tomcat/apache-tomcat-8.0.23
Using CATALINA_HOME:   /opt/tomcat/apache-tomcat-8.0.23
Using CATALINA_TMPDIR: /opt/tomcat/apache-tomcat-8.0.23/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /opt/tomcat/apache-tomcat-8.0.23/bin/bootstrap.jar:/opt/tomcat/apache-tomcat-8.0.23/bin/tomcat-juli.jar
Tomcat started.

apache tomcat 8.0.23_home_page

Similarly, you can use any port of your choice. Make sure the port you are using don’ t conflict with any other application/resource.

Step 4:

Configuring Apache Tomcat 8

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

To add a Tomcat user edit file ‘ /opt/tomcat/apache-tomcat-8.0.23/conf/tomcat-users.xml‘ , in your favorite editor.

[root@linuxhelp bin]# vim /opt/tomcat/apache-tomcat-8.0.23/conf/tomcat-users.xml

10. Add the following lines just before ‘ ‘ .

schema location

Restart Apache Tomcat

Restart the Apache tomacat by running the tomcatup and tomcatdown command in the terminal.

[root@linuxhelp bin]# tomcatup
Using CATALINA_BASE:   /opt/tomcat/apache-tomcat-8.0.23
Using CATALINA_HOME:   /opt/tomcat/apache-tomcat-8.0.23
Using CATALINA_TMPDIR: /opt/tomcat/apache-tomcat-8.0.23/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /opt/tomcat/apache-tomcat-8.0.23/bin/bootstrap.jar:/opt/tomcat/apache-tomcat-8.0.23/bin/tomcat-juli.jar
Tomcat started.
[root@linuxhelp bin]# tomcatdown
Using CATALINA_BASE:   /opt/tomcat/apache-tomcat-8.0.23
Using CATALINA_HOME:   /opt/tomcat/apache-tomcat-8.0.23
Using CATALINA_TMPDIR: /opt/tomcat/apache-tomcat-8.0.23/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /opt/tomcat/apache-tomcat-8.0.23/bin/bootstrap.jar:/opt/tomcat/apache-tomcat-8.0.23/bin/tomcat-juli.jar
[root@linuxhelp bin]#

After restarting Tomcat, make sure to access the admin other sections like Host Manager, etc at http://127.0.0.1:198. It you will be asked to Enter User_name and Password, you just created above, after login you will see something like the below interface.

login page

host manager

Your all setting and basic configuration of Tomcat has finished now. Now we will see a simple example, to run a simple basic jsp program run in Tomcat. It would be dumb if we do not show it.

Create a file called linuxhelp.jsp under ‘ /opt/tomcat/apache-tomcat-8.0.23/webapps/ROOT‘ directory.

[root@linuxhelp bin]# vim /opt/tomcat/apache-tomcat-8.0.23/webapps/ROOT/linuxhelp.jsp

Now add the below contents in the new file (linuxhelp.jsp), save and exit.

tomcat server

Most of the things in the above codes are self explaining. We have put simple Java code to print two lines of output and embed it in between HTML codes, which can be accessed at http://127.0.0.1:198/linuxhelp.jsp.

Running application

The above are steps to install and configure Apache Tomcat 8.0.23 in CentOS 7.

Tags:
dylan
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What is the latest version of tomcat?

A

latest version is 9.0.x

Q

Can i able to install both tomcat apache and httpd on same server. Will it serve pages from both web servers??

A

Its possible, because httpd runs on 80 port whereas workbench runs on 8080 port. So you can run both web servers and to serve page make the configurations as required

Q

how to configure two apache instances in CentOS

A

https://www.linuxhelp.com/how-to-configure-multiple-instance-of-apache-on-the-same-server-in-centos-6-7/

Q

why should we go for apache tomcat?

A

if your using a java project you should go for apache tomcat it will be using Java servlets and JSP

Q

How to look into kernel issues with Shorewall?

A

By using this "route filter" option you can see the issues in Shorewall.

Related Tutorials in How to install and Configure Apache Tomcat 8.0.23

Related Tutorials in How to install and Configure Apache Tomcat 8.0.23

How To Install AnyDesk on Centos 7
How To Install AnyDesk on Centos 7
Apr 2, 2018
How to install Tiki Wiki CMS Groupware on CentOS 7
How to install Tiki Wiki CMS Groupware on CentOS 7
May 31, 2018
How to install PHP ImageMagick on CentOS 7
How to install PHP ImageMagick on CentOS 7
Nov 4, 2017
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
Jun 4, 2019
How to install Apache from Source Code on CentOS 7
How to install Apache from Source Code on CentOS 7
Oct 21, 2017
How to enable or disable repositories in CentOS
How to enable or disable repositories in CentOS
Mar 28, 2018
How to install AWStats on CentOS 7
How to install AWStats on CentOS 7
Dec 8, 2017
How to install Apache JMeter in CentOS 7
How to install Apache JMeter in CentOS 7
Mar 24, 2017

Related Forums in How to install and Configure Apache Tomcat 8.0.23

Related Forums in How to install and Configure Apache Tomcat 8.0.23

CentOS
connor class=
How To Completely Remove Apache package On CentOS 7.6
May 14, 2019
Web Server
jacob class=
How to remove httpd completely from server
Apr 7, 2017
CentOS
ceriaimmaculate class=
setfacl : command not found
Jan 3, 2018
CentOS
mason class=
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
Nov 20, 2018
CentOS
landon class=
Command to find SNMP Version
May 28, 2018
CentOS
arjitharon class=
cannot start minio service help
Mar 10, 2018
Apache tomcat
AadrikaAnshu class=
Cannot find ./catalina.sh The file is absent or does not have execute permission This file is needed to run this program
Jun 17, 2019
gitlab
caden class=
Insufficient space in download directory /var/cache/yum/x86_64/6/base/packages
Jul 22, 2019

Related News in How to install and Configure Apache Tomcat 8.0.23

Related News in How to install and Configure Apache Tomcat 8.0.23

PHP7 bugs used by hackers to remotely hijack web servers
PHP7 bugs used by hackers to remotely hijack web servers
Nov 5, 2019
Red Hat the New Steward of OpenJDK 8 and OpenJDK 11
Red Hat the New Steward of OpenJDK 8 and OpenJDK 11
Apr 25, 2019
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Ryan ?
how to use visual traceroute tool

Am using traceroute command to check for the route. i got this tool while surfing. So pls help me out installation and usage of Visual traceroute tool.

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.