Skip to main content
Install Tomcat

Installing a Tomcat server on CentOS 7

21 May 2024

Introduction

Apache Tomcat (also known as Jakarta Tomcat or simply Tomcat) functions as a servlet container developed under the Jakarta project at the Apache Software Foundation. Tomcat implements the specifications of servlets and JavaServer Pages (JSP) from Oracle Corporation (originally created by Sun Microsystems).

In this article, we will provide a guide to install this winning combination of Tomcat and CentOS in its latest published version.

Installing the Java Virtual Machine

Apache Tomcat runs on a Java Virtual Machine, which is available in the CentOS repository. To update the system and install Java, execute the following commands:

yum clean all
yum update -y
yum install -y java-1.8.0-openjdk-devel

With this, we have installed Java and prepared the system to run Tomcat.

Creating a Tomcat User

It is common to create a group with an assigned user that will run Tomcat. The following commands create a user without login access, assign the user to the Tomcat group, and set /opt/tomcat as the home directory:

groupadd tomcat
useradd -M -s /bin/nologin -g tomcat -d /opt/tomcat tomcat

Installing Tomcat

Download Tomcat from the official website, for example from the link http://apache.rediris.es/tomcat/tomcat-8/v8.5.34/bin/apache-tomcat-8.5…, and upload it to the server using any FTP program. It is common practice to decompress the file on the server and create a symbolic link to the installed version to facilitate future updates. Execute the following commands:

tar xvf apache-tomcat-8.5.34.tar.gz
ln -s apache-tomcat-8.5.34 tomcat

Next, we need to set permissions and ownership for the folder and its various subfolders and files. This is done with the following commands:

cd /opt/tomcat
 

Add new comment

HTML Restringido

  • You can align images (data-align="center"), but also videos, blockquotes, and so on.
  • You can caption images (data-caption="Text"), but also videos, blockquotes, and so on.

Contact info

Global leader in consulting services, digital transformation, technology, and engineering.

  • Camino de las Ceudas 2 Bis
    28032 - Las Rozas de Madrid
  • (+34)647 555 222
  • info@aeioros.com