<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tomcat Archives - LinuxTuto</title>
	<atom:link href="https://www.linuxtuto.com/tag/tomcat/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.linuxtuto.com/tag/tomcat/</link>
	<description>Linux Sysadmin and DevOps blog</description>
	<lastBuildDate>Sat, 03 Dec 2022 12:00:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://www.linuxtuto.com/wp-content/uploads/2022/01/cropped-LT_faveicon-32x32.png</url>
	<title>Tomcat Archives - LinuxTuto</title>
	<link>https://www.linuxtuto.com/tag/tomcat/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">201456972</site>	<item>
		<title>How to Install Tomcat 10 on Debian 11</title>
		<link>https://www.linuxtuto.com/how-to-install-tomcat-10-on-debian-11/</link>
					<comments>https://www.linuxtuto.com/how-to-install-tomcat-10-on-debian-11/#respond</comments>
		
		<dc:creator><![CDATA[LinuxTuto]]></dc:creator>
		<pubDate>Sat, 29 Jan 2022 15:47:36 +0000</pubDate>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Tomcat]]></category>
		<guid isPermaLink="false">https://www.linuxtuto.com/?p=213</guid>

					<description><![CDATA[<p>Apache Tomcat is an open-source Java HTTP web server developed by the Apache Software Foundation. Tomcat helps to deploy the Java Servlet and the JavaServer...</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-install-tomcat-10-on-debian-11/">How to Install Tomcat 10 on Debian 11</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Apache Tomcat is an open-source Java HTTP web server developed by the Apache Software Foundation. Tomcat helps to deploy the Java Servlet and the JavaServer Pages and serves them like an HTTP web server.</p>
<p>In this tutorial, we will show you the complete steps to install <code>Tomcat 10</code> on Debian 11.</p>
<h2><span class="has-inline-color has-vivid-purple-color">Update Operating System</span></h2>
<p>Update your <strong>Debian 11</strong> operating system to make sure all existing packages are up to date:</p>
<pre><code>$ sudo apt update &amp;&amp; sudo apt upgrade -y</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Install Java 17 (OpenJDK 17) on Debian 11</span></h2>
<p>Java 17 packages are available on Debian 11 repositories and you can install it with the following command:</p>
<pre><code>$ sudo apt install openjdk-17-jdk</code></pre>
<p>Check Java version after installation:</p>
<pre><code>$ java -version
openjdk version "17.0.1" 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12-Debian-1deb11u2)
OpenJDK 64-Bit Server VM (build 17.0.1+12-Debian-1deb11u2, mixed mode, sharing)</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Create Tomcat User</span></h2>
<p>It is recommended to have <code>tomcat</code> user for tomcat services.</p>
<p>To create a new account, type:</p>
<pre><code>sudo useradd -m -d /opt/tomcat -U -s /bin/false tomcat </code></pre>
<p>The above command will create a user and group with the name “<code>tomcat</code>” in your system.</p>
<h2><span class="has-inline-color has-vivid-purple-color">Download and Install Tomcat</span></h2>
<p>You can download the <code>Tomcat 10</code> directly from the <a href="https://tomcat.apache.org/download-10.cgi" target="_blank" rel="noopener">official webpage of the Tomcat</a>, or use the <strong>wget</strong> command:</p>
<pre><code>$ sudo wget https://downloads.apache.org/tomcat/tomcat-10/v10.0.16/bin/apache-tomcat-10.0.16.tar.gz</code></pre>
<p>Extract the downloaded file to <code>/opt/tomcat</code> directory using <code>tar</code> command:</p>
<pre><code>$ sudo tar xpvf apache-tomcat-10.0.16.tar.gz -C /opt/tomcat --strip-components=1</code></pre>
<p>Set the correct permissions on files and directories:</p>
<pre><code>$ sudo chown tomcat:tomcat /opt/tomcat/ -R
$ sudo chmod u+x /opt/tomcat/bin -R</code></pre>
<h2><span class="has-inline-color has-vivid-purple-color">Create a Systemd service file</span></h2>
<p>By default, we won’t have a <code>Systemd</code> unit file for <code>Tomcat</code>to run it in the background and to easily stop, start and enable its services.</p>
<p>Create systemd unit for <code>tomcat</code> to start / stop and restart service.</p>
<pre><code>nano /etc/systemd/system/tomcat.service</code></pre>
<p>Paste following lines:</p>
<pre><code>[Unit]
Description=Tomcat
After=syslog.target network.target
[Service]
Type=forking

User=tomcat
Group=tomcat

Environment=JAVA_HOME=/usr/lib/jvm/java-1.17.0-openjdk-amd64
Environment='JAVA_OPTS=-Djava.awt.headless=true'

Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

[Install]
WantedBy=multi-user.target </code></pre>
<p>Reload system daemon and start Tomcat Service:</p>
<pre><code>$ sudo systemctl daemon-reload
$ sudo systemctl start tomcat
$ sudo systemctl enable tomcat</code></pre>
<p>To confirm everything is working normally, check the status of service:</p>
<pre><code>systemctl status tomcat</code></pre>
<p>Output:</p>
<pre><code><span style="color: #00ff00;">●</span> tomcat.service - Tomcat
Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: enabled)
Active: <span style="color: #00ff00;">active (running)</span>
Main PID: 5605 (java)
Tasks: 37 (limit: 2301)
Memory: 77.1M
CPU: 5.700s
CGroup: /system.slice/tomcat.service
└─5605 /usr/lib/jvm/java-1.17.0-openjdk-amd64/bin/java -Djava.util.logging.config.fil&gt;</code></pre>
<p><strong>Note:</strong> In case firewall is enable and running on your Debian 11 system then allow <code>8080</code> tcp port:</p>
<pre><code>$ sudo ufw allow 8080/tcp</code></pre>
<p>Now open your web browser and type <code>https://yourIP:8080</code>. You will see the default <code>tomcat</code> page.</p>
<figure id="attachment_227" aria-describedby="caption-attachment-227" style="width: 1024px" class="wp-caption alignnone"><img fetchpriority="high" decoding="async" class="size-large wp-image-227" src="https://www.linuxtuto.com/wp-content/uploads/2022/01/apache_tomcat_10-1024x771.jpg" alt="Apache Tomcat Web Server" width="1024" height="771" srcset="https://www.linuxtuto.com/wp-content/uploads/2022/01/apache_tomcat_10-1024x771.jpg 1024w, https://www.linuxtuto.com/wp-content/uploads/2022/01/apache_tomcat_10-300x226.jpg 300w, https://www.linuxtuto.com/wp-content/uploads/2022/01/apache_tomcat_10-768x579.jpg 768w, https://www.linuxtuto.com/wp-content/uploads/2022/01/apache_tomcat_10-1222x921.jpg 1222w, https://www.linuxtuto.com/wp-content/uploads/2022/01/apache_tomcat_10-897x676.jpg 897w, https://www.linuxtuto.com/wp-content/uploads/2022/01/apache_tomcat_10-684x515.jpg 684w, https://www.linuxtuto.com/wp-content/uploads/2022/01/apache_tomcat_10-360x270.jpg 360w, https://www.linuxtuto.com/wp-content/uploads/2022/01/apache_tomcat_10.jpg 1253w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption id="caption-attachment-227" class="wp-caption-text">Apache Tomcat</figcaption></figure>
<h2><span class="has-inline-color has-vivid-purple-color">Add Roles and Admin username and password</span></h2>
<p>To do it, you need to edit the configuration file <code>/opt/tomcat/conf/tomcat-users.xml</code>. You can edit it with <code>nano</code> by executing the following command:</p>
<pre><code>$ sudo nano /opt/tomcat/conf/tomcat-users.xml</code></pre>
<p>Add following lines before context <code>&lt;/tomcat-users&gt;</code>:</p>
<pre><code>&lt;role rolename="admin"/&gt;
&lt;role rolename="admin-gui"/&gt;
&lt;role rolename="manager"/&gt;
&lt;role rolename="manager-gui"/&gt;

&lt;user username="<strong>linuxtuto</strong>" password="<strong>Pa$$word</strong>" roles="admin,admin-gui,manager,manager-gui"/&gt;</code></pre>
<p>save and exit the file.</p>
<h2><span class="has-inline-color has-vivid-purple-color">Allow Remote Access of Tomcat</span></h2>
<p>By default, you won’t be able to access your installed <code>Tomcat</code> Manager sections (web interface) outside the local system.</p>
<p>In case you want to access <code>tomcat</code> applications from outside then edit the <code>context.xml</code> file for manager &amp; host-manager and comment out the remote access section:</p>
<pre><code>$ sudo nano /opt/tomcat/webapps/manager/META-INF/context.xml</code></pre>
<pre><code>........
&lt;!--      &lt;Valve className="org.apache.catalina.valves.RemoteAddrValve"
                 allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /&gt;
  --&gt;
........
</code></pre>
<pre><code>$ sudo nano /opt/tomcat/webapps/host-manager/META-INF/context.xml</code></pre>
<pre><code>........
&lt;!--      &lt;Valve className="org.apache.catalina.valves.RemoteAddrValve"
                 allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /&gt;
  --&gt;
........
</code></pre>
<p>Restart Tomcat service:</p>
<pre><code>$ sudo systemctl restart tomcat</code></pre>
<p>To Access <code>Tomcat</code> Web Manager page type <code>http://yourIP:8080/manager/html</code></p>
<p>It will prompt for username and password, Use username and password that you specify in the <code>‘/opt/tomcat/conf/tomcat-users.xml’</code> file:</p>
<figure id="attachment_233" aria-describedby="caption-attachment-233" style="width: 1024px" class="wp-caption aligncenter"><img decoding="async" class="size-large wp-image-233" src="https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Web_Application_Manager-1024x583.jpg" alt="Tomcat Web Application Manager" width="1024" height="583" srcset="https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Web_Application_Manager-1024x583.jpg 1024w, https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Web_Application_Manager-300x171.jpg 300w, https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Web_Application_Manager-768x438.jpg 768w, https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Web_Application_Manager-1536x875.jpg 1536w, https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Web_Application_Manager-1222x696.jpg 1222w, https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Web_Application_Manager-897x511.jpg 897w, https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Web_Application_Manager-684x390.jpg 684w, https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Web_Application_Manager.jpg 1894w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption id="caption-attachment-233" class="wp-caption-text">Tomcat Web Application Manager</figcaption></figure>
<p>To access <code>Tomcat</code> Host Manager Web Page page type <code>http://yourIP:8080/host-manager/html</code></p>
<p>It will prompt for username and password, Use username and password that you specify in the <code>‘/opt/tomcat/conf/tomcat-users.xml’</code> file:</p>
<figure id="attachment_234" aria-describedby="caption-attachment-234" style="width: 1024px" class="wp-caption aligncenter"><img decoding="async" class="size-large wp-image-234" src="https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Virtual_Host_Manager-1024x531.jpg" alt="Tomcat Virtual Host Manager" width="1024" height="531" srcset="https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Virtual_Host_Manager-1024x531.jpg 1024w, https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Virtual_Host_Manager-300x156.jpg 300w, https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Virtual_Host_Manager-768x399.jpg 768w, https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Virtual_Host_Manager-1536x797.jpg 1536w, https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Virtual_Host_Manager-1222x634.jpg 1222w, https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Virtual_Host_Manager-897x466.jpg 897w, https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Virtual_Host_Manager-684x355.jpg 684w, https://www.linuxtuto.com/wp-content/uploads/2022/01/Tomcat_Virtual_Host_Manager.jpg 1917w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption id="caption-attachment-234" class="wp-caption-text">Tomcat Virtual Host Manager</figcaption></figure>
<h2><span class="has-inline-color has-vivid-purple-color">Comments and Conclusion</span></h2>
<p>That’s it. You have successfully installed <code>Tomcat 10</code> on Debian 11. If you have any questions please leave a comment below.</p>
<p>The post <a href="https://www.linuxtuto.com/how-to-install-tomcat-10-on-debian-11/">How to Install Tomcat 10 on Debian 11</a> appeared first on <a href="https://www.linuxtuto.com">LinuxTuto</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.linuxtuto.com/how-to-install-tomcat-10-on-debian-11/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">213</post-id>	</item>
	</channel>
</rss>
