{"id":10056,"date":"2024-08-21T10:59:28","date_gmt":"2024-08-21T10:59:28","guid":{"rendered":"https:\/\/arzhost.com\/blogs\/?p=10056"},"modified":"2025-08-30T16:29:13","modified_gmt":"2025-08-30T11:29:13","slug":"how-to-install-apache-tomcat-on-linux","status":"publish","type":"post","link":"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/","title":{"rendered":"How to Install Apache Tomcat on Linux? Step-by-Step Guide"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_74 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#Mastering_Linux_How_to_Set_Up_Apache_Tomcat_in_a_Few_Simple_Steps\" >Mastering Linux: How to Set Up Apache Tomcat in a Few Simple Steps<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#What_is_Apache_Tomcat\" >What is Apache Tomcat?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#How_to_Install_Apache_Tomcat_on_Linux_7_Ways\" >How to Install Apache Tomcat on Linux? 7 Ways&nbsp;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#Step-By-Step_Apache_Tomcat_Installation_Guide\" >Step-By-Step Apache Tomcat Installation Guide:<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#Step_1_Update_Your_Alma_Linux_System\" >Step #1: Update Your Alma Linux System<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#Step_2_Install_Java_on_Linux\" >Step #2: Install Java on Linux<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#Step_3_Create_a_Tomcat_Service_Account_on_Linux\" >Step #3: Create a Tomcat Service Account on Linux<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#Step_4_Install_Apache_Tomcat_on_AlmaLinux\" >Step #4: Install Apache Tomcat on AlmaLinux<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#Step_5_Create_Apache_Tomcat_Systemd_Service\" >Step #5: Create Apache Tomcat Systemd Service<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#Step_6_Configure_Linux_Firewall_for_Tomcat\" >Step #6: Configure Linux Firewall for Tomcat<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#Step_7_Configure_Apache_Tomcat_Application_Manager_on_AlmaLinux\" >Step #7: Configure Apache Tomcat Application Manager on AlmaLinux<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#Conclusion\" >Conclusion&nbsp;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#FAQs_Frequently_Asked_Questions\" >FAQs (Frequently Asked Questions)<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#1_What_is_Apache_Tomcat_and_why_would_I_need_it_on_Linux\" >1: What is Apache Tomcat and why would I need it on Linux?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#2_How_do_I_install_Apache_Tomcat_on_Linux\" >2: How do I install Apache Tomcat on Linux?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#3_What_are_the_system_requirements_for_running_Apache_Tomcat_on_Linux\" >3: What are the system requirements for running Apache Tomcat on Linux?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#4_How_can_I_secure_Apache_Tomcat_on_Linux\" >4: How can I secure Apache Tomcat on Linux?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/arzhost.com\/blogs\/how-to-install-apache-tomcat-on-linux\/#5_Can_Apache_Tomcat_coexist_with_other_web_servers_like_Apache_HTTP_Server_on_Linux\" >5: Can Apache Tomcat coexist with other web servers like Apache HTTP Server on Linux?<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Mastering_Linux_How_to_Set_Up_Apache_Tomcat_in_a_Few_Simple_Steps\"><\/span><strong>Mastering Linux: How to Set Up Apache Tomcat in a Few Simple Steps<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Today, we will discuss how to <strong>install Apache Tomcat on Linux<\/strong>. Installation instructions have already been covered here. We&#8217;ll use Ubuntu to show how to install it in this guide.<\/p>\n\n\n\n<p>Even if you&#8217;re using a different distribution, you can still follow this instruction. Make sure you utilize the package manager for your particular distribution to&nbsp;do this.<\/p>\n\n\n\n<p>To install Java Servlets and JSPs on your machine, use the <strong>Java application server Tomcat<\/strong>. One of the most popular Java web servers and apps, it was created by the Apache Software Foundation.<\/p>\n\n\n\n<p>In an attempt to develop an HTTP server that was entirely based on Java and supported Java code operations, Apache Tomcat was developed.<\/p>\n\n\n\n<p>Tomcat&#8217;s popularity has been largely attributed to its open-source nature. We hope to help you in installing Apache Tomcat on Linux with this tutorial.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Apache_Tomcat\"><\/span><strong>What is Apache Tomcat?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong><a href=\"https:\/\/tomcat.apache.org\/\" data-type=\"link\" data-id=\"https:\/\/tomcat.apache.org\/\" target=\"_blank\" rel=\"noopener\">Apache Tomcat<\/a><\/strong> is a free and open-source software that plays a critical role in running Java-based web applications. Developed by the Apache Software Foundation, Tomcat functions as both a web server and a servlet container.<\/p>\n\n\n\n<p>Imagine a web server as a translator that receives requests from users&#8217; browsers and delivers responses in a format the browser can understand. Tomcat acts as this <strong>translator<\/strong> specifically for Java applications. It provides a pure Java environment where Java code can be executed.<\/p>\n\n\n\n<p>However, Tomcat&#8217;s functionality g<strong>oes beyond a basic web server<\/strong>. It also incorporates servlet container capabilities. Servlets are essentially mini-programs written in Java that can dynamically generate content or handle user requests.&nbsp;<\/p>\n\n\n\n<p>The servlet container, in this case, Tomcat, manages the lifecycle of these servlets, including loading them when needed and unloading them when not in use.<\/p>\n\n\n\n<p>Apache Tomcat is a free and open-source software that functions as both a web server and a servlet container. Here&#8217;s a breakdown of its key aspects:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>For Java Applications:<\/strong> Tomcat is specifically designed to handle Java-based web applications. It provides a runtime environment where Java code can execute and interact with web requests.<\/li>\n\n\n\n<li><strong>Servlet Container:<\/strong> At its core, Tomcat acts as a servlet container. Servlets are essentially Java programs that can be used to extend the functionalities of a standard web server. Tomcat manages the lifecycle of these servlets, including loading, unloading, and handling requests.<\/li>\n\n\n\n<li><strong>Lightweight and Efficient:<\/strong> Compared to a full-fledged Java application server, Tomcat is lightweight and efficient. This makes it a popular choice for deploying smaller web applications or those that don&#8217;t require the extensive features of a full application server.<\/li>\n\n\n\n<li><strong>Open-Source and Popular:<\/strong> Developed by the Apache Software Foundation, Tomcat is an open-source project. This means it&#8217;s freely available for anyone to use and modify, contributing to its widespread adoption.<\/li>\n<\/ol>\n\n\n\n<p>In simpler terms, imagine Apache Tomcat as a platform specifically designed to run Java web applications. It bridges the gap between the web server and the Java code, enabling dynamic content generation and processing of user requests.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Install_Apache_Tomcat_on_Linux_7_Ways\"><\/span><strong>How to Install Apache Tomcat on Linux? 7 Ways&nbsp;<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong>Apache Tomcat<\/strong> is a popular open-source web server and servlet container for running Java applications. Installing Tomcat on AlmaLinux, a community-driven rebuild of RHEL, involves several steps.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step-By-Step_Apache_Tomcat_Installation_Guide\"><\/span><strong>Step-By-Step Apache Tomcat Installation Guide:<\/strong> <span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This guide will walk you through the process to ensure a smooth installation.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_1_Update_Your_Alma_Linux_System\"><\/span><strong>Step #1: Update Your Alma Linux System<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Before installing any software, it\u2019s important to ensure your system is up-to-date. Open a terminal and run the following commands:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>sudo dnf update -y\nsudo dnf upgrade -y<\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9\">sudo<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">dnf<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">update<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">y<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">sudo<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">dnf<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">upgrade<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">y<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><strong>Updating your system<\/strong> ensures that you have the latest security patches and software updates, which is crucial for maintaining system stability and security.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_2_Install_Java_on_Linux\"><\/span><strong>Step #2: Install Java on Linux<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p><strong>Apache Tomcat requires Java <\/strong>to run. You can install OpenJDK, which is an open-source implementation of the Java Platform. If you run <strong>CentOS <\/strong>then you need to <strong><a href=\"https:\/\/arzhost.com\/blogs\/install-java-11-12-on-centos-7\/\" data-type=\"link\" data-id=\"https:\/\/arzhost.com\/blogs\/install-java-11-12-on-centos-7\/\">install Java 11 or 12 on CentOS 7<\/a><\/strong>. Run the following command to install OpenJDK 11:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>sudo dnf install java-11-openjdk-devel -y<\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9\">sudo<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">dnf<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">install<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">java<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #B48EAD\">11<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">openjdk<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">devel<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">y<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Verify the installation by checking the Java version:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>java -version<\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9\">java<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">version<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>You should see output indicating that Java 11 is installed.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_3_Create_a_Tomcat_Service_Account_on_Linux\"><\/span><strong>Step #3: Create a Tomcat Service Account on Linux<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>For security reasons, it&#8217;s best to run Tomcat under its own user account rather than using the root account. Create a new user and group for Tomcat with the following commands:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>sudo groupadd tomcat\n\nsudo useradd -M -s \/bin\/nologin -g tomcat -d \/opt\/tomcat<\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9\">sudo<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">groupadd<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">tomcat<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">sudo<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">useradd<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">M<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">s<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">bin<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">nologin<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">g<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">tomcat<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">d<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">opt<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">tomcat<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>This creates a group named tomcat and a user named tomcat without a home directory and login shell.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_4_Install_Apache_Tomcat_on_AlmaLinux\"><\/span><strong>Step #4: Install Apache Tomcat on AlmaLinux<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Download the latest version of Apache Tomcat from the official Tomcat website. Navigate to the \/opt directory and download the Tomcat tar.gz file using wget:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>cd \/opt<\/li>\n<\/ul>\n\n\n\n<p>sudo wget https:\/\/downloads.apache.org\/tomcat\/tomcat-9\/v9.0.56\/bin\/apache-tomcat-9.0.56.tar.gz<\/p>\n\n\n\n<p>Extract the downloaded file:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>sudo tar xvf apache-tomcat-9.0.56.tar.gz<\/li>\n\n\n\n<li>sudo mv apache-tomcat-9.0.56 tomcat<\/li>\n<\/ul>\n\n\n\n<p>Set the appropriate permissions:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>sudo chown -R tomcat: tomcat \/opt\/tomcat<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_5_Create_Apache_Tomcat_Systemd_Service\"><\/span><strong>Step #5: Create Apache Tomcat Systemd Service<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>To manage Tomcat as a system service, create a new systemd service file. Open a new file in your preferred text editor:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>sudo nano \/etc\/systemd\/system\/tomcat. Service<\/li>\n<\/ul>\n\n\n\n<p><strong>Add the following content to the file:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>[Unit]\n\nDescription=Apache Tomcat Web Application Container\n\nAfter=network.target\n\n[Service]\n\nType=forking\n\nUser=tomcat\n\nGroup=tomcat\n\nEnvironment=\u201dJAVA_HOME=\/usr\/lib\/jvm\/jre\u201d\n\nEnvironment=\u201dCATALINA_PID=\/opt\/tomcat\/temp\/tomcat.pid\u201d\n\nEnvironment=\u201dCATALINA_HOME=\/opt\/tomcat\u201d\n\nEnvironment=\u201dCATALINA_BASE=\/opt\/tomcat\u201d\n\nEnvironment=\u201dCATALINA_OPTS=-Xms512M -Xmx1024M -server -XX: +Subparallel\u201d\n\nEnvironment=\u201dJAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:\/dev\/.\/urandom\u201d\n\nExecStart=\/opt\/tomcat\/bin\/startup.sh\n\nExecStop=\/opt\/tomcat\/bin\/shutdown.sh\n\n[Install]\nWanted By=multi-user. target<\/textarea><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">[<\/span><span style=\"color: #D8DEE9\">Unit<\/span><span style=\"color: #D8DEE9FF\">]<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">Description<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9\">Apache<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">Tomcat<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">Web<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">Application<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">Container<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">After<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9\">network<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">target<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">[<\/span><span style=\"color: #D8DEE9\">Service<\/span><span style=\"color: #D8DEE9FF\">]<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">Type<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9\">forking<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">User<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9\">tomcat<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">Group<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9\">tomcat<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">Environment<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\">\u201d<\/span><span style=\"color: #D8DEE9\">JAVA_HOME<\/span><span style=\"color: #81A1C1\">=\/<\/span><span style=\"color: #D8DEE9\">usr<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">lib<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">jvm<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">jre<\/span><span style=\"color: #D8DEE9FF\">\u201d<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">Environment<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\">\u201d<\/span><span style=\"color: #D8DEE9\">CATALINA_PID<\/span><span style=\"color: #81A1C1\">=\/<\/span><span style=\"color: #D8DEE9\">opt<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">tomcat<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">temp<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">tomcat<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">pid<\/span><span style=\"color: #D8DEE9FF\">\u201d<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">Environment<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\">\u201d<\/span><span style=\"color: #D8DEE9\">CATALINA_HOME<\/span><span style=\"color: #81A1C1\">=\/<\/span><span style=\"color: #D8DEE9\">opt<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">tomcat<\/span><span style=\"color: #D8DEE9FF\">\u201d<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">Environment<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\">\u201d<\/span><span style=\"color: #D8DEE9\">CATALINA_BASE<\/span><span style=\"color: #81A1C1\">=\/<\/span><span style=\"color: #D8DEE9\">opt<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">tomcat<\/span><span style=\"color: #D8DEE9FF\">\u201d<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">Environment<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\">\u201d<\/span><span style=\"color: #D8DEE9\">CATALINA_OPTS<\/span><span style=\"color: #81A1C1\">=-<\/span><span style=\"color: #D8DEE9\">Xms512M<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">Xmx1024M<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">server<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9FF\">XX<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">+<\/span><span style=\"color: #D8DEE9\">Subparallel<\/span><span style=\"color: #D8DEE9FF\">\u201d<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">Environment<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\">\u201d<\/span><span style=\"color: #D8DEE9\">JAVA_OPTS<\/span><span style=\"color: #81A1C1\">=-<\/span><span style=\"color: #D8DEE9\">Djava<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">awt<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">headless<\/span><span style=\"color: #81A1C1\">=true<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">Djava<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">security<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">egd<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\">file<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #ECEFF4\">\/<\/span><span style=\"color: #EBCB8B\">dev<\/span><span style=\"color: #ECEFF4\">\/<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">urandom<\/span><span style=\"color: #D8DEE9FF\">\u201d<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">ExecStart<\/span><span style=\"color: #81A1C1\">=\/<\/span><span style=\"color: #D8DEE9\">opt<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">tomcat<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">bin<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">startup<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">sh<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">ExecStop<\/span><span style=\"color: #81A1C1\">=\/<\/span><span style=\"color: #D8DEE9\">opt<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">tomcat<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">bin<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">shutdown<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">sh<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">[<\/span><span style=\"color: #D8DEE9\">Install<\/span><span style=\"color: #D8DEE9FF\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">Wanted<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">By<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9\">multi<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">user<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">target<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Save and close the file. Reload the systemd daemon to apply the changes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>sudo systemctl daemon-reload<\/li>\n<\/ul>\n\n\n\n<p>Start the Tomcat service and enable it to start on boot:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>sudo systemctl start tomcat<\/li>\n\n\n\n<li>sudo systemctl enable tomcat<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_6_Configure_Linux_Firewall_for_Tomcat\"><\/span><strong>Step #6: Configure Linux Firewall for Tomcat<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>To allow traffic to Tomcat, you need to open the necessary ports in your firewall. By default, Tomcat listens on port 8080. Use the <strong>following commands<\/strong> to allow traffic on this port:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>sudo firewall-cmd &#8211;permanent &#8211;zone=public &#8211;add-port=8080\/tcp<\/li>\n\n\n\n<li>sudo firewall-cmd &#8211;reload<\/li>\n<\/ul>\n\n\n\n<p>Verify the firewall settings to ensure the port is open:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>sudo firewall-cmd &#8211;list-all<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_7_Configure_Apache_Tomcat_Application_Manager_on_AlmaLinux\"><\/span><strong>Step #7: Configure Apache Tomcat Application Manager on AlmaLinux<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Tomcat&#8217;s Application Manager allows you to manage your web applications through a <strong>web interface.<\/strong> To enable access, you need to configure the tomcat-users.xml file. Open the file in your text editor:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>sudo nano \/opt\/tomcat\/conf\/tomcat-users.xml<\/li>\n<\/ul>\n\n\n\n<p>Add the following lines within the &lt;tomcat-users&gt; tags to create a user with manager-gui and admin-gui roles:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&lt;role name=&#8221;manager-gui&#8221;\/&gt;<\/li>\n\n\n\n<li>&lt;role name=&#8221;admin-gui&#8221;\/&gt;<\/li>\n\n\n\n<li>&lt;user username=&#8221;admin&#8221; password=&#8221;yourpassword&#8221; roles=&#8221;manager-gui, admin-gui&#8221;\/&gt;<\/li>\n<\/ul>\n\n\n\n<p>Replace your password with a strong password of your choice. Save and close the file. Restart Tomcat to apply the changes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>sudo systemctl restart tomcat<\/li>\n<\/ul>\n\n\n\n<p>Now, you can access the Tomcat Application Manager by navigating to http:\/\/your-server-ip:8080\/manager\/html and logging in with the credentials you specified.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2025\/08\/configure-apache-tomcat-application-manager-on-almalinux.jpg\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"536\" title=\"configure apache tomcat application manager on almalinux\" src=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2025\/08\/configure-apache-tomcat-application-manager-on-almalinux-1024x536.jpg\" alt=\"configure apache tomcat application manager on almalinux\" class=\"wp-image-12359\" srcset=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2025\/08\/configure-apache-tomcat-application-manager-on-almalinux-1024x536.jpg 1024w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2025\/08\/configure-apache-tomcat-application-manager-on-almalinux-300x157.jpg 300w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2025\/08\/configure-apache-tomcat-application-manager-on-almalinux-768x402.jpg 768w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2025\/08\/configure-apache-tomcat-application-manager-on-almalinux.jpg 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">configure apache tomcat application manager on almalinux<\/figcaption><\/figure>\n\n\n\n<p>Following these seven steps, you should have a fully functional Apache Tomcat server running on AlmaLinux. Regularly update your system and Tomcat installation to ensure security and stability. At <strong><a href=\"https:\/\/arzhost.com\/\" data-type=\"link\" data-id=\"https:\/\/arzhost.com\/\">ARZ Host<\/a><\/strong>, we provide reliable <strong>Linux hosting services<\/strong> that can support your <strong>Apache Tomcat<\/strong> deployment, ensuring your server runs efficiently and securely.<\/p>\n\n\n\n<p>With Tomcat installed, you can now deploy and manage your Java web applications efficiently.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><strong>Conclusion&nbsp;<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Tomcat is an <strong>effective tool for implementing JSPs and Java Servlets<\/strong>. It enables you to run Java code on a web server that was created solely with Java. We hope that this article helped you set up Apache Tomcat on Linux and set up some basic settings.<\/p>\n\n\n\n<p>Additionally, you can modify the Tomcat server&#8217;s parameters to suit your tastes. Please feel free to contact us using the comments section below if you have any questions, comments, or suggestions.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"FAQs_Frequently_Asked_Questions\"><\/span><strong>FAQs (Frequently Asked Questions)<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_What_is_Apache_Tomcat_and_why_would_I_need_it_on_Linux\"><\/span><strong>1: What is Apache Tomcat and why would I need it on Linux?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Apache Tomcat is an open-source Java servlet container that allows you to run Java applications. It&#8217;s widely used for hosting Java-based web applications and websites.<\/p>\n\n\n\n<p>Installing Apache Tomcat on Linux provides a robust environment to deploy and manage Java web applications, making it essential for developers and administrators working with Java applications on Linux servers. you can learn about the<strong><a href=\"https:\/\/arzhost.com\/blogs\/linux-server-vs-windows-server\/\" data-type=\"link\" data-id=\"https:\/\/arzhost.com\/blogs\/linux-server-vs-windows-server\/\"> difference between Linux Servers and Windows Servers<\/a><\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_How_do_I_install_Apache_Tomcat_on_Linux\"><\/span><strong>2: How do I install Apache Tomcat on Linux?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>To install Apache Tomcat on Linux, you typically download the latest version from the Apache Tomcat website. After downloading, you extract the archive to a preferred directory using commands like tar.<\/p>\n\n\n\n<p>Then, configure environment variables such as CATALINA_HOME and optionally JAVA_HOME to point to your Java installation. Finally, start Tomcat using the startup scripts provided (startup.sh), and you can access the Tomcat server via a web browser.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_What_are_the_system_requirements_for_running_Apache_Tomcat_on_Linux\"><\/span><strong>3: What are the system requirements for running Apache Tomcat on Linux?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Apache Tomcat has modest system requirements. It runs efficiently on Linux systems with a minimum of 1 GB RAM, although for production environments or heavier loads, 2 GB or more is recommended. Disk space requirements depend on the applications you deploy, but typically a few hundred megabytes are sufficient.<\/p>\n\n\n\n<p>Tomcat supports various Linux distributions such as Ubuntu, CentOS, and Debian, among others.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_How_can_I_secure_Apache_Tomcat_on_Linux\"><\/span><strong>4: How can I secure Apache Tomcat on Linux?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Securing Apache Tomcat on Linux involves several best practices. You should:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Disable unnecessary services and ports.<\/li>\n\n\n\n<li>Use strong, unique passwords for administrative accounts.<\/li>\n\n\n\n<li>Configure HTTPS to encrypt data between clients and the server.<\/li>\n\n\n\n<li>Regularly update Tomcat to the latest stable version to patch security vulnerabilities.<\/li>\n\n\n\n<li>Implement access controls using firewalls and Tomcat&#8217;s built-in security features like user roles and permissions.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_Can_Apache_Tomcat_coexist_with_other_web_servers_like_Apache_HTTP_Server_on_Linux\"><\/span><strong>5: Can Apache Tomcat coexist with other web servers like Apache HTTP Server on Linux?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Yes, Apache Tomcat can coexist with other web servers like Apache HTTP Server (commonly referred to as Apache). This setup is often used to improve performance and flexibility.<\/p>\n\n\n\n<p>You can configure Apache HTTP Server as a front-end server to handle static content and forward dynamic requests to Tomcat. This configuration, known as reverse proxying or using mod_jk\/mod_proxy, allows both servers to work together seamlessly on a single Linux machine, serving different types of content efficiently.<\/p>\n\n\n\n<p><strong>Read More:<\/strong><\/p>\n\n\n<ul class=\"wp-block-latest-posts__list wp-block-latest-posts\"><li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/arzhost.com\/blogs\/how-to-fix-403-forbidden-error-wordpress\/\">How To Fix 403 Forbidden Error WordPress<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/arzhost.com\/blogs\/how-to-get-the-most-out-of-claude-ai\/\">How To Get The Most Out Of Claude Ai<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/arzhost.com\/blogs\/bad-gateway-error-502-the-ultimate-guide-to-quick-fixes\/\">Bad Gateway Error (502): The Ultimate Guide to Quick Fixes<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/arzhost.com\/blogs\/a-deep-dive-into-todays-best-linux-distros\/\">A Deep Dive Into Today\u2019s Best Linux Distros<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/arzhost.com\/blogs\/domain-investor-terms-powerful-strategy\/\">Domain Investor Terms: Expert Insight on Powerful Strategy<\/a><\/li>\n<\/ul>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mastering Linux: How to Set Up Apache Tomcat in a Few Simple Steps Today, we will discuss how to install Apache Tomcat on Linux. Installation instructions have already been covered here. We&#8217;ll use Ubuntu to show how to install it in this guide. Even if you&#8217;re using a different distribution, you can still follow this [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":10059,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[117],"tags":[],"table_tags":[],"class_list":["post-10056","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/10056","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/comments?post=10056"}],"version-history":[{"count":1,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/10056\/revisions"}],"predecessor-version":[{"id":12360,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/10056\/revisions\/12360"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/media\/10059"}],"wp:attachment":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/media?parent=10056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/categories?post=10056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/tags?post=10056"},{"taxonomy":"table_tags","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/table_tags?post=10056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}