{"id":2299,"date":"2024-04-23T00:48:27","date_gmt":"2025-08-10T21:03:30","guid":{"rendered":""},"modified":"2025-02-02T00:46:18","modified_gmt":"2025-02-01T23:46:18","slug":"how-to-install-apache-tomcat-on-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/netcloud24.com\/knowledgebase\/how-to-install-apache-tomcat-on-ubuntu-22-04\/","title":{"rendered":"Linux VPS &#038; VPS Windows Setup Guide | NetCloud24 Apache Tomcat on Ubuntu 22.04"},"content":{"rendered":"<p>\u00a0<\/p>\n<\/p>\n<header><\/header>\n<article>\n<p>Apache Tomcat is an open-source web server and servlet container developed by the Apache Software Foundation. It is used to deploy Java-based web applications. In this guide, we will show you how to install and configure Apache Tomcat on Ubuntu 22.04. Whether you are setting this up locally or using a , these steps will help you get started.<\/p>\n<section>\n<h2>Step 1: Update Your System<\/h2>\n<p>Before installing Apache Tomcat, make sure your system is up to date. Run the following commands:<\/p>\n<pre><code>sudo apt update &amp;&amp; sudo apt upgrade -y<\/code><\/pre>\n<p>It is crucial to keep your system updated for security and performance, especially if you are running it on a <a href=\"https:\/\/ie.netcloud24.com\">VPS Windows VPS Servers<\/a> platform.<\/p>\n<\/section>\n<section>\n<h2>Step 2: Install Java<\/h2>\n<p>Apache Tomcat requires Java to run. Install the latest OpenJDK package by running:<\/p>\n<pre><code>sudo apt install openjdk-11-jdk -y<\/code><\/pre>\n<p>Verify the Java installation:<\/p>\n<pre><code>java -version<\/code><\/pre>\n<\/section>\n<section>\n<h2>Step 3: Create a Tomcat User<\/h2>\n<p>For security reasons, it is a good idea to run Tomcat under a separate user. Create a new user and group for Tomcat:<\/p>\n<pre><code>sudo groupadd tomcat\r\nsudo useradd -s \/bin\/false -g tomcat -d \/opt\/tomcat tomcat<\/code><\/pre>\n<\/section>\n<section>\n<h2>Step 4: Download and Install Apache Tomcat<\/h2>\n<p>Go to the official Apache Tomcat website to download the latest version. Use the following command to download Tomcat:<\/p>\n<pre><code>\r\ncd \/tmp\r\nwget https:\/\/downloads.apache.org\/tomcat\/tomcat-10\/v10.1.0\/bin\/apache-tomcat-10.1.0.tar.gz\r\n            <\/code><\/pre>\n<p>Extract the downloaded file to the <code>\/opt\/tomcat<\/code> directory:<\/p>\n<pre><code>sudo mkdir \/opt\/tomcat\r\nsudo tar xzvf apache-tomcat-10.1.0.tar.gz -C \/opt\/tomcat --strip-components=1<\/code><\/pre>\n<\/section>\n<section>\n<h2>Step 5: Configure Permissions<\/h2>\n<p>Set the correct permissions for the Tomcat directory:<\/p>\n<pre><code>sudo chown -R tomcat: \/opt\/tomcat\r\nsudo chmod -R 755 \/opt\/tomcat<\/code><\/pre>\n<\/section>\n<section>\n<h2>Step 6: Create a Systemd Service File for Tomcat<\/h2>\n<p>Create a systemd service file to manage the Tomcat service:<\/p>\n<pre><code>sudo nano \/etc\/systemd\/system\/tomcat.service<\/code><\/pre>\n<p>Add the following content to the file:<\/p>\n<pre><code>\r\n[Unit]\r\nDescription=Apache Tomcat Web Application Container\r\nAfter=network.target\r\n\r\n[Service]\r\nType=forking\r\n\r\nUser=tomcat\r\nGroup=tomcat\r\n\r\nEnvironment=\"JAVA_HOME=\/usr\/lib\/jvm\/java-11-openjdk-amd64\"\r\nEnvironment=\"CATALINA_PID=\/opt\/tomcat\/temp\/tomcat.pid\"\r\nEnvironment=\"CATALINA_HOME=\/opt\/tomcat\"\r\nEnvironment=\"CATALINA_BASE=\/opt\/tomcat\"\r\nEnvironment=\"CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC\"\r\nEnvironment=\"JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:\/dev\/.\/urandom\"\r\n\r\nExecStart=\/opt\/tomcat\/bin\/startup.sh\r\nExecStop=\/opt\/tomcat\/bin\/shutdown.sh\r\n\r\nRestart=on-failure\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n            <\/code><\/pre>\n<p>Save and close the file.<\/p>\n<p>Reload systemd to apply the new service file:<\/p>\n<pre><code>sudo systemctl daemon-reload<\/code><\/pre>\n<\/section>\n<section>\n<h2>Step 7: Start Tomcat Service<\/h2>\n<p>Start and enable the Tomcat service:<\/p>\n<pre><code>sudo systemctl start tomcat\r\nsudo systemctl enable tomcat<\/code><\/pre>\n<p>Check the status of the Tomcat service:<\/p>\n<pre><code>sudo systemctl status tomcat<\/code><\/pre>\n<\/section>\n<section>\n<h2>Step 8: Configure Firewall (Optional)<\/h2>\n<p>If you have UFW (Uncomplicated Firewall) enabled, allow traffic on port 8080, which Tomcat uses:<\/p>\n<pre><code>sudo ufw allow 8080<\/code><\/pre>\n<\/section>\n<section>\n<h2>Step 9: Access Tomcat Web Interface<\/h2>\n<p>You can now access the Tomcat web interface by opening your browser and navigating to:<\/p>\n<pre><code>http:\/\/:8080<\/code><\/pre>\n<p>You should see the Apache Tomcat default page, indicating that Tomcat is successfully installed.<\/p>\n<\/section>\n<footer>\n<p>You have successfully installed Apache Tomcat on Ubuntu 22.04. Apache Tomcat is now ready for deploying your Java-based web applications. For reliable and scalable hosting solutions, consider using . They offer a variety of hosting options, including <strong>windows virtual private servers<\/strong>, <strong>vps windows hosting<\/strong>, and <strong>windows virtual dedicated server hosting<\/strong>. Whether you are looking for <strong>windows vps italy<\/strong> or <strong>uk vps windows<\/strong>, their hosting services provide the performance and flexibility needed for hosting Java applications.<\/p>\n<\/footer>\n<\/article>\n<div class=\"post-author-box\" style=\"border-top:1px solid #ddd;margin-top:20px;padding-top:15px;\">\n<p><strong>Author:<\/strong> \u0141ukasz Bodziony<\/p>\n<p><strong>Website:<\/strong> <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a><\/p>\n<p><em>\u0141ukasz Bodziony is the CEO and founder of <a href=\"https:\/\/netcloud24.com\" target=\"_blank\" rel=\"dofollow\">NETCLOUD24<\/a>, a global VPS hosting brand proudly originating from Poland. With extensive experience in cloud computing, virtualization, and server management, he delivers high-performance <strong>Windows VPS<\/strong> and <strong>Remote Desktop Services (RDS)<\/strong> solutions to clients across Europe, North America, and beyond.<\/em><\/p>\n<p><em>His expertise covers a wide range of technologies, including <strong>Microsoft Azure<\/strong>, <strong>Proxmox VE<\/strong>, <strong>Amazon Web Services (AWS)<\/strong>, and numerous other virtualization and cloud platforms.<\/em><\/p>\n<p><em>Beyond running his hosting business, \u0141ukasz also provides <strong>professional paid server configuration and optimization services<\/strong> for companies and individuals. Outside of work, he is dedicated to caring for his children and building a secure future for them.<\/em><\/p>\n<p><em>If you are interested in working with him or need expert assistance with your hosting, cloud environment, or server setup, feel free to reach out via <a href=\"https:\/\/ca.netcloud24.com\" target=\"_blank\" rel=\"dofollow\">Windows VPS<\/a>.<\/em><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0 Apache Tomcat is an open-source web server and servlet container developed by the Apache Software Foundation. It is used to deploy Java-based web applications. In this guide,\u2026<\/p>\n","protected":false},"author":1,"featured_media":3421,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[],"tags":[14,12,11,23,20,21,22,17,7,8,6,10,18,19,15,24,16,5,13,9],"class_list":["post-2299","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-cheapvps","tag-cloudvps","tag-hostingvps","tag-rds","tag-rdscal","tag-remotedesktop","tag-remotedesktopvps","tag-servervps","tag-ukvps","tag-virtualserver","tag-vpshosting","tag-vpsserver","tag-vpssolutions","tag-vpswindows","tag-vpswithwindows","tag-windowsrds","tag-windowsserver","tag-windowsvps","tag-windowsvpshosting","tag-windowsvpsuk"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=2299"}],"version-history":[{"count":0,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/2299\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media\/3421"}],"wp:attachment":[{"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=2299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=2299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netcloud24.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=2299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}