{"id":16530,"date":"2024-11-01T21:04:58","date_gmt":"2024-11-01T21:04:58","guid":{"rendered":"https:\/\/truehost.com\/support\/?post_type=docs&#038;p=16530"},"modified":"2024-11-01T21:15:47","modified_gmt":"2024-11-01T21:15:47","password":"","slug":"how-to-install-and-configure-apache-tomcat-on-linux-almalinux","status":"publish","type":"docs","link":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-install-and-configure-apache-tomcat-on-linux-almalinux\/","title":{"rendered":"How to Install and Configure Apache Tomcat on Linux &#8211; Almalinux"},"content":{"rendered":"\n<p>Here\u2019s a step-by-step guide to installing and configuring Apache Tomcat on AlmaLinux.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Prerequisites: Installing Java<\/h3>\n\n\n\n<p>Apache Tomcat requires Java to run, so start by installing OpenJDK on your AlmaLinux system.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Update System Packages<\/h4>\n\n\n\n<p>Update the package index to ensure you have the latest version of each package:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf update -y<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Install Java<\/h4>\n\n\n\n<p>Use the <code>dnf<\/code> package manager to install the default Java Development Kit (JDK):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo dnf install -y java-11-openjdk<\/code><\/pre>\n\n\n\n<p>Once installed, verify the Java version to ensure it\u2019s set up correctly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>java -version<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Creating a Tomcat User<\/h3>\n\n\n\n<p>Running Tomcat as the root user isn\u2019t secure, so create a dedicated user for Tomcat with restricted permissions.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo useradd -r -m -U -d \/opt\/tomcat -s \/bin\/false tomcat<\/code><\/pre>\n\n\n\n<p>This creates a system user named <code>tomcat<\/code>, with its home directory at <code>\/opt\/tomcat<\/code>, which we\u2019ll use as the Tomcat installation directory.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Downloading and Extracting Tomcat<\/h3>\n\n\n\n<p>Visit the <a href=\"https:\/\/tomcat.apache.org\/download-90.cgi\">Apache Tomcat download page<\/a> to get the latest version. Here, we\u2019ll use version 9.0.34 as an example.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Download Tomcat<\/h4>\n\n\n\n<p>Download the tarball using <code>wget<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget -c https:\/\/downloads.apache.org\/tomcat\/tomcat-9\/v9.0.34\/bin\/apache-tomcat-9.0.34.tar.gz<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Extract the Tomcat Archive<\/h4>\n\n\n\n<p>After downloading, extract the archive to the <code>\/opt\/tomcat<\/code> directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mkdir \/opt\/tomcat\nsudo tar xf apache-tomcat-9.0.34.tar.gz -C \/opt\/tomcat<\/code><\/pre>\n\n\n\n<p>To make future updates easier, create a symbolic link named <code>latest<\/code> that points to the Tomcat installation directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ln -s \/opt\/tomcat\/apache-tomcat-9.0.34 \/opt\/tomcat\/latest<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Set Permissions<\/h4>\n\n\n\n<p>Ensure the <code>tomcat<\/code> user has full ownership of the Tomcat directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chown -R tomcat: \/opt\/tomcat<br>sudo chmod +x \/opt\/tomcat\/latest\/bin\/*.sh<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Configuring Tomcat as a Systemd Service<\/h3>\n\n\n\n<p>To run Tomcat as a service on AlmaLinux, create a systemd unit file.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Create a Unit File<\/h4>\n\n\n\n<p>Create a new file for the Tomcat service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/systemd\/system\/tomcat.service<\/code><\/pre>\n\n\n\n<p>Add the following content, adjusting the <code>JAVA_HOME<\/code> path if needed:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;Unit]\nDescription=Apache Tomcat Web Application Container\nAfter=network.target\n\n&#91;Service]\nType=forking\n\nEnvironment=\"JAVA_HOME=\/usr\/lib\/jvm\/java-11-openjdk\"\nEnvironment=\"CATALINA_PID=\/opt\/tomcat\/latest\/temp\/tomcat.pid\"\nEnvironment=\"CATALINA_HOME=\/opt\/tomcat\/latest\"\nEnvironment=\"CATALINA_BASE=\/opt\/tomcat\/latest\"\nEnvironment=\"CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC\"\nEnvironment=\"JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:\/dev\/.\/urandom\"\n\nExecStart=\/opt\/tomcat\/latest\/bin\/startup.sh\nExecStop=\/opt\/tomcat\/latest\/bin\/shutdown.sh\n\nUser=tomcat\nGroup=tomcat\nUMask=0007\nRestartSec=10\nRestart=always\n\n&#91;Install]\nWantedBy=multi-user.target\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Reload the Systemd Daemon<\/h4>\n\n\n\n<p>Reload systemd to recognize the new Tomcat service file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl daemon-reload<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Start and Enable the Tomcat Service<\/h4>\n\n\n\n<p>Now, start the Tomcat service and enable it to start on boot:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl start tomcat\nsudo systemctl enable tomcat<\/code><\/pre>\n\n\n\n<p>Verify the Tomcat Service Status<\/p>\n\n\n\n<p>Check the status to make sure Tomcat is running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl status tomcat<\/code><\/pre>\n\n\n\n<p>5. Configuring the Firewall<\/p>\n\n\n\n<p>If you have a firewall enabled, allow access to Tomcat\u2019s default port, 8080:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo firewall-cmd --permanent --add-port=8080\/tcp\nsudo firewall-cmd --reload<\/code><\/pre>\n\n\n\n<p>6. Verifying the Tomcat Installation<\/p>\n\n\n\n<p>To verify that Tomcat is successfully installed, open a browser and go to the following URL, replacing <code>&lt;YourIPAddress><\/code> with the server\u2019s IP address:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;:your_ip_addresss:8080<\/code><\/pre>\n\n\n\n<p>If everything was configured correctly, you should see the Tomcat default welcome page.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Optional: Securing the Tomcat Manager and Host Manager<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Enable the Tomcat Manager Application<\/strong> by editing the <code>tomcat-users.xml<\/code> file:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/opt\/tomcat\/latest\/conf\/tomcat-users.xml<\/code><\/pre>\n\n\n\n<p>   2<strong>. Add Roles and a User<\/strong>: Add a user with <code>manager-gui<\/code> and <code>admin-gui<\/code> roles:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;role rolename=\"manager-gui\"\/>\n&lt;role rolename=\"admin-gui\"\/>\n&lt;user username=\"admin\" password=\"your_password\" roles=\"manager-gui,admin-gui\"\/><\/code><\/pre>\n\n\n\n<p>3. <strong>Restart Tomcat<\/strong> to apply changes:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart tomcat<\/code><\/pre>\n\n\n\n<p>You can now log in to the Manager and Host Manager applications using the configured credentials.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Author&#8217;s Final Word<\/h3>\n\n\n\n<p>This guide covers the installation and basic configuration of Apache Tomcat on AlmaLinux. You\u2019re now ready to deploy and manage Java web applications on Tomcat. Remember to keep Tomcat up to date for security and performance improvements.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here\u2019s a step-by-step guide to installing and configuring Apache Tomcat on AlmaLinux. 1. Prerequisites: Installing Java Apache Tomcat requires Java to run, so start by installing OpenJDK on your AlmaLinux system. Update System Packages Update the package index to ensure you have the latest version of each package: Install Java Use the dnf package manager [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_eb_attr":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"doc_category":[1820,1824,1879,2128],"doc_tag":[],"class_list":["post-16530","docs","type-docs","status-publish","hentry","doc_category-cloud-servers-in-kenya","doc_category-dedicated-servers","doc_category-servers","doc_category-vps-servers"],"year_month":"2026-07","word_count":663,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"Eugene","author_nicename":"eugene","author_url":"https:\/\/truehost.com\/support\/author\/eugene\/"},"doc_category_info":[{"term_name":"Cloud servers in Kenya","term_url":"https:\/\/truehost.com\/support\/docs-category\/cloud-servers-in-kenya\/"},{"term_name":"dedicated servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/dedicated-servers\/"},{"term_name":"Servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/servers\/"},{"term_name":"VPS-Servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/vps-servers\/"}],"doc_tag_info":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Install and Configure Apache Tomcat on Linux - Almalinux -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-install-and-configure-apache-tomcat-on-linux-almalinux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install and Configure Apache Tomcat on Linux - Almalinux -\" \/>\n<meta property=\"og:description\" content=\"Here\u2019s a step-by-step guide to installing and configuring Apache Tomcat on AlmaLinux. 1. Prerequisites: Installing Java Apache Tomcat requires Java to run, so start by installing OpenJDK on your AlmaLinux system. Update System Packages Update the package index to ensure you have the latest version of each package: Install Java Use the dnf package manager [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-install-and-configure-apache-tomcat-on-linux-almalinux\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T21:15:47+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-install-and-configure-apache-tomcat-on-linux-almalinux\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-install-and-configure-apache-tomcat-on-linux-almalinux\\\/\",\"name\":\"How to Install and Configure Apache Tomcat on Linux - Almalinux -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#website\"},\"datePublished\":\"2024-11-01T21:04:58+00:00\",\"dateModified\":\"2024-11-01T21:15:47+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-install-and-configure-apache-tomcat-on-linux-almalinux\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-install-and-configure-apache-tomcat-on-linux-almalinux\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-install-and-configure-apache-tomcat-on-linux-almalinux\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/truehost.com\\\/support\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install and Configure Apache Tomcat on Linux &#8211; Almalinux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#website\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/\",\"name\":\"\",\"description\":\"Help In a Click\",\"publisher\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/truehost.com\\\/support\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#organization\",\"name\":\"Truehost Kenya\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"contentUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"width\":240,\"height\":48,\"caption\":\"Truehost Kenya\"},\"image\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install and Configure Apache Tomcat on Linux - Almalinux -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-install-and-configure-apache-tomcat-on-linux-almalinux\/","og_locale":"en_US","og_type":"article","og_title":"How to Install and Configure Apache Tomcat on Linux - Almalinux -","og_description":"Here\u2019s a step-by-step guide to installing and configuring Apache Tomcat on AlmaLinux. 1. Prerequisites: Installing Java Apache Tomcat requires Java to run, so start by installing OpenJDK on your AlmaLinux system. Update System Packages Update the package index to ensure you have the latest version of each package: Install Java Use the dnf package manager [&hellip;]","og_url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-install-and-configure-apache-tomcat-on-linux-almalinux\/","article_modified_time":"2024-11-01T21:15:47+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-install-and-configure-apache-tomcat-on-linux-almalinux\/","url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-install-and-configure-apache-tomcat-on-linux-almalinux\/","name":"How to Install and Configure Apache Tomcat on Linux - Almalinux -","isPartOf":{"@id":"https:\/\/truehost.com\/support\/#website"},"datePublished":"2024-11-01T21:04:58+00:00","dateModified":"2024-11-01T21:15:47+00:00","breadcrumb":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-install-and-configure-apache-tomcat-on-linux-almalinux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/truehost.com\/support\/knowledge-base\/how-to-install-and-configure-apache-tomcat-on-linux-almalinux\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-install-and-configure-apache-tomcat-on-linux-almalinux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/truehost.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Install and Configure Apache Tomcat on Linux &#8211; Almalinux"}]},{"@type":"WebSite","@id":"https:\/\/truehost.com\/support\/#website","url":"https:\/\/truehost.com\/support\/","name":"","description":"Help In a Click","publisher":{"@id":"https:\/\/truehost.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/truehost.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/truehost.com\/support\/#organization","name":"Truehost Kenya","url":"https:\/\/truehost.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/truehost.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","contentUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","width":240,"height":48,"caption":"Truehost Kenya"},"image":{"@id":"https:\/\/truehost.com\/support\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/16530","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/comments?post=16530"}],"version-history":[{"count":2,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/16530\/revisions"}],"predecessor-version":[{"id":16533,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/16530\/revisions\/16533"}],"wp:attachment":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/media?parent=16530"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_category?post=16530"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_tag?post=16530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}