<?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>Apache Tomcat Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/apache-tomcat/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Wed, 28 Oct 2020 19:43:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.12</generator>
	<item>
		<title>How to install Apache Tomcat on Ubuntu 20.04 / Debian 10?</title>
		<link>https://www.osradar.com/install-apache-tomcat-ubuntu-debian/</link>
					<comments>https://www.osradar.com/install-apache-tomcat-ubuntu-debian/#comments</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Thu, 29 Oct 2020 02:39:00 +0000</pubDate>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache Tomcat]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[servlet]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Tutorial]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=12786</guid>

					<description><![CDATA[<p>Even though Python is the most popular programming language actually, there is still confidence in Java. So you probably needed to make applications with this veteran language. Especially in the web environment that there are so many good languages and tools, Java still resists. So, to deploy web applications made in Java is Tomcat. With [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/install-apache-tomcat-ubuntu-debian/">How to install Apache Tomcat on Ubuntu 20.04 / Debian 10?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Even though Python is the most popular programming language actually, there is still confidence in Java. So you probably needed to make applications with this veteran language. Especially in the web environment that there are so many good languages and tools, Java still resists. So, to deploy web applications made in Java is Tomcat. With the main objective that you learn how to install Apache Tomcat on Ubuntu 20.04 / Debian 10 is that this post has been written. Let us get started.</p>
<h2>Apache Tomcat</h2>
<p><a href="https://www.osradar.com/tag/java/" rel="noopener">Java</a> and its multipurpose language and that make it so good and useful to learn. Well, after coding your web application, it gets to the point where you have to deploy it. To do this, it requires a server that can interpret that Java code. Remember that we are talking about web applications. And to deploy and serve it, nothing like <a href="https://tomcat.apache.org/" rel="noopener">Apache Tomcat</a>.</p>
<p>Estricatemente speaking Tomcat is not a server but transforms the caught JPS into servlets that can serve the application in question.</p>
<p>On the other hand, Apache Tomcat is open source and can be installed on any system running Java.</p>
<h2>Install Apache Tomcat on Ubuntu 20.04 / Debian 10</h2>
<h3>1) Install and configure Java on Ubuntu 20.04 / Debian 10</h3>
<p>Apache Tomcat is an application made with Java. Therefore, the first step is to install Java on <a href="https://www.osradar.com/tag/buster/" rel="noopener">Debian 10</a>.</p>
<p>Open a terminal session and run the following:</p>
<pre>:~$ sudo apt install default-jre default-jdk</pre>
<p>Then, check the java version.</p>
<pre>:~$ java --version
openjdk 11.0.3 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+7-post-Debian-5)
OpenJDK 64-Bit Server VM (build 11.0.3+7-post-Debian-5, mixed mode, sharing)</pre>
<p>As you can see, Java version 11 has been installed. It is one of the most recent and with very good support.</p>
<p>Now, you have to modify the<code> /etc/environment</code> file and add the Java path.</p>
<pre>:~$ sudo nano /etc/environment</pre>
<p>And add the following:</p>
<pre class="">JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64/"</pre>
<p>Save the changes and close the file.</p>
<p>The next step is to edit the .bashrc file and add the following:</p>
<pre>:~$ sudo nano .bashrc</pre>
<pre class="">export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64/"
export PATH=$JAVA_HOME/bin:$PATH</pre>
<figure id="attachment_12801" aria-describedby="caption-attachment-12801" style="width: 560px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-12801" src="https://www.osradar.com/wp-content/uploads/2019/07/1-5.jpeg" alt="1.- Editing the bash profile" width="560" height="272" srcset="https://www.osradar.com/wp-content/uploads/2019/07/1-5.jpeg 560w, https://www.osradar.com/wp-content/uploads/2019/07/1-5-300x146.jpeg 300w" sizes="(max-width: 560px) 100vw, 560px" /><figcaption id="caption-attachment-12801" class="wp-caption-text">1.- Editing the bash profile</figcaption></figure>
<p>Again, save the changes and close the file.</p>
<p>Next, refresh the bash.</p>
<pre>:~$ source .bashrc</pre>
<p>Now, type this command to test the Java path.</p>
<pre>:~$ echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-amd64/bin/java</pre>
<p>So, if you got the Java path from your computer, everything is correct.</p>
<h3>2) Install Apache Tomcat on Ubunut 20.04 / Debian 10</h3>
<p>For security reasons, it is convenient to create a new user for Tomcat. Also, add it to a group called tomcat.</p>
<pre>:~$ sudo -i
:~# groupadd tomcat
:~# useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat</pre>
<figure id="attachment_12802" aria-describedby="caption-attachment-12802" style="width: 562px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-12802" src="https://www.osradar.com/wp-content/uploads/2019/07/2-4.jpeg" alt="2.- Creating a new user for apache" width="562" height="198" srcset="https://www.osradar.com/wp-content/uploads/2019/07/2-4.jpeg 562w, https://www.osradar.com/wp-content/uploads/2019/07/2-4-300x106.jpeg 300w" sizes="(max-width: 562px) 100vw, 562px" /><figcaption id="caption-attachment-12802" class="wp-caption-text">2.- Creating a new user for apache</figcaption></figure>
<p>Now we can install Apache Tomcat. To do this, go to the<code> /opt</code>/ folder and download with <code>wget</code>.</p>
<pre>:~# cd /opt/
:~# wget -c https://downloads.apache.org/tomcat/tomcat-9/v9.0.39/bin/apache-tomcat-9.0.39.tar.gz<br />--2020-10-28 19:23:24-- https://downloads.apache.org/tomcat/tomcat-9/v9.0.39/bin/apache-tomcat-9.0.39.tar.gz<br />Resolving downloads.apache.org (downloads.apache.org)... 88.99.95.219, 2a01:4f8:10a:201a::2<br />Connecting to downloads.apache.org (downloads.apache.org)|88.99.95.219|:443... connected.<br />HTTP request sent, awaiting response... 200 OK<br />Length: 11282879 (11M) [application/x-gzip]<br />Saving to: ‘apache-tomcat-9.0.39.tar.gz’<br />apache-tomcat-9.0.39.tar.gz 100%[=====================================================================================&gt;] 10.76M 157KB/s in 1m 49s<br />2020-10-28 19:25:15 (101 KB/s) - ‘apache-tomcat-9.0.39.tar.gz’ saved [11282879/11282879]</pre>
<p>Then, decompress it and rename the folder.</p>
<pre>:~# tar -xzvf apache-tomcat-9.0.39.tar.gz
:~# mv apache-tomcat-9.0.39 tomcat</pre>
<p>After that, you need to change the owner of the folder and assign the required permissions so that it can run smoothly. Remember that now, we are using the root user.</p>
<pre class="">:~# chown -R tomcat:tomcat /opt/tomcat/
:~# chmod +x /opt/tomcat/bin/*</pre>
<p>Now, on the .bashrc file add the CATALINA_HOME path.</p>
<pre>:~# nano ~/.bashrc
export CATALINA_HOME=/opt/tomcat</pre>
<p>Save the changes and close the file.</p>
<p>Then, refresh bash.</p>
<pre>:~# source ~/.bashrc</pre>
<p>After that, we can run Apache Tomcat. To do it, just type this command:</p>
<pre>:~# /opt/tomcat/bin/startup.sh</pre>
<figure id="attachment_12804" aria-describedby="caption-attachment-12804" style="width: 641px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-12804" src="https://www.osradar.com/wp-content/uploads/2019/07/4-1.jpeg" alt="4.- Tomcat is running" width="641" height="194" srcset="https://www.osradar.com/wp-content/uploads/2019/07/4-1.jpeg 641w, https://www.osradar.com/wp-content/uploads/2019/07/4-1-300x91.jpeg 300w" sizes="(max-width: 641px) 100vw, 641px" /><figcaption id="caption-attachment-12804" class="wp-caption-text">4.- Tomcat is running</figcaption></figure>
<p>Next, open your web browser ad go <code>http://your-server:8080</code>. And you will see this.</p>
<figure id="attachment_24865" aria-describedby="caption-attachment-24865" style="width: 1354px" class="wp-caption alignnone"><img loading="lazy" class="wp-image-24865 size-full" src="https://www.osradar.com/wp-content/uploads/2019/07/tomcat.png" alt="5.- Apache Tomcat on Ubuntu 20.04 / Debian 10" width="1354" height="669" srcset="https://www.osradar.com/wp-content/uploads/2019/07/tomcat.png 1354w, https://www.osradar.com/wp-content/uploads/2019/07/tomcat-300x148.png 300w, https://www.osradar.com/wp-content/uploads/2019/07/tomcat-1024x506.png 1024w, https://www.osradar.com/wp-content/uploads/2019/07/tomcat-768x379.png 768w, https://www.osradar.com/wp-content/uploads/2019/07/tomcat-696x344.png 696w, https://www.osradar.com/wp-content/uploads/2019/07/tomcat-1068x528.png 1068w" sizes="(max-width: 1354px) 100vw, 1354px" /><figcaption id="caption-attachment-24865" class="wp-caption-text">5.- Apache Tomcat on Ubuntu 20.04 / Debian 10</figcaption></figure>
<p>If you want to set a password to improve security of the manager web app. So, open the <code>tomcat-users.xml</code></p>
<pre>:~# nano /opt/tomcat/conf/tomcat-users.xml</pre>
<p>In the <code>tomcat-user</code> section, you have to add the username and password.</p>
<pre class="">&lt;role rolename="manager-gui"/&gt;
&lt;user username="XXXXXX" password="XXXXXXX" roles="manager-gui,admin-gui"/&gt;</pre>
<figure id="attachment_12807" aria-describedby="caption-attachment-12807" style="width: 761px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-12807" src="https://www.osradar.com/wp-content/uploads/2019/07/6-1.jpeg" alt="6.- Change the username and password" width="761" height="373" srcset="https://www.osradar.com/wp-content/uploads/2019/07/6-1.jpeg 761w, https://www.osradar.com/wp-content/uploads/2019/07/6-1-300x147.jpeg 300w, https://www.osradar.com/wp-content/uploads/2019/07/6-1-324x160.jpeg 324w, https://www.osradar.com/wp-content/uploads/2019/07/6-1-533x261.jpeg 533w, https://www.osradar.com/wp-content/uploads/2019/07/6-1-696x341.jpeg 696w" sizes="(max-width: 761px) 100vw, 761px" /><figcaption id="caption-attachment-12807" class="wp-caption-text">6.- Change the username and password</figcaption></figure>
<p>Of course, replace the password for yours.</p>
<p>Then, restart Tomcat.</p>
<pre class="">:~# ./shutdown.sh
:~# ./startup.sh</pre>
<p>And go to the web browser again. Next, refresh the page. And that is it.</p>
<h2>Conclusion</h2>
<p>Apache Tomcat is the best solution to deploy and serve web applications made with Java. So if you program in Java, you should learn how to manipulate Tomcat. As you have learned in this post, it is not very complex to learn how to install it in  Ubuntu 20.04 / Debian 10.</p>
<p>Please share this post with your friends and join <a href="http://t.me/osradar" target="_blank" rel="noopener noreferrer">our Telegram channel</a>.</p>


<p></p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/install-apache-tomcat-ubuntu-debian/">How to install Apache Tomcat on Ubuntu 20.04 / Debian 10?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/install-apache-tomcat-ubuntu-debian/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>How to install Apache Tomcat on CentOS 7?</title>
		<link>https://www.osradar.com/install-apache-tomcat-centos-7/</link>
					<comments>https://www.osradar.com/install-apache-tomcat-centos-7/#respond</comments>
		
		<dc:creator><![CDATA[angeloma]]></dc:creator>
		<pubDate>Fri, 12 Oct 2018 04:00:55 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache Tomcat]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JavaEE]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[Servlets]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[web]]></category>
		<guid isPermaLink="false">https://www.osradar.com/?p=6348</guid>

					<description><![CDATA[<p>To install Apache Tomcat on Linux requires certain steps that are not very complex. However, we&#8217;ve talked about it before recently. Today, I will show you how to install it, this time, on CentOS 7. In short, Apache Tomcat executes Java servlets and renders Web pages that include Java Server Page coding. It constitutes a [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/install-apache-tomcat-centos-7/">How to install Apache Tomcat on CentOS 7?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>To install Apache Tomcat on Linux requires certain steps that are not very complex. However, <a href="https://www.osradar.com/how-to-install-tomcat-on-debian-9-stretch/" rel="noopener">we&#8217;ve talked</a> about it before recently. Today, I will show you how to install it, this time, on CentOS 7.</p>
<p>In short, <a href="http://tomcat.apache.org/" rel="noopener">Apache Tomcat</a> executes Java servlets and renders Web pages that include Java Server Page coding. It constitutes a base element for the development with Java. It is very popular and it is open source.</p>
<p>This time I will install using CentOS 7, which is a Red Hat-based Linux distribution for use on Servers.</p>
<h2>What you need</h2>
<p>The process is very simple and you should not take long to do it, but it is good that you know that there are some small requirements to successfully complete this tutorial.</p>
<ul>
<li>A server with CentOS 7 installed and allowing access via ssh.</li>
<li>A basic knowledge about the use of commands in the terminal.</li>
<li>A user who allows commands to be run as root. Or root access.</li>
</ul>
<p>I think this will be enough for you to do everything without problems.</p>
<p>Let&#8217;s get to work.</p>
<h2>1. Upgrade the system</h2>
<p>In order to have the latest security patches, it is necessary to update the system completely. Also with this, you will have a more secure server and in many cases faster. Run as root user:</p>
<pre class="">:~# yum update</pre>
<p><figure id="attachment_6349" aria-describedby="caption-attachment-6349" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-6349" src="https://www.osradar.com/wp-content/uploads/2018/10/1-8.png" alt="1.- Upgrading CentOS" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/10/1-8.png 1366w, https://www.osradar.com/wp-content/uploads/2018/10/1-8-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/10/1-8-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/10/1-8-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/10/1-8-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/10/1-8-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/10/1-8-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-6349" class="wp-caption-text">1.- Upgrading CentOS</figcaption></figure></p>
<p>That&#8217;s enough.</p>
<h2>2.- Install Java</h2>
<p>To install Apache Tomcat you first need to install Java because it is a dependency. To do this, type the following:</p>
<pre class="">:~# yum install java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64</pre>
<p><figure id="attachment_6350" aria-describedby="caption-attachment-6350" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-6350" src="https://www.osradar.com/wp-content/uploads/2018/10/2-8.png" alt="2.- Installing Java from the CLI" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/10/2-8.png 1366w, https://www.osradar.com/wp-content/uploads/2018/10/2-8-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/10/2-8-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/10/2-8-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/10/2-8-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/10/2-8-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/10/2-8-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-6350" class="wp-caption-text">2.- Installing Java from the CLI</figcaption></figure></p>
<p>Next, check the installed Java version.</p>
<pre class="">:~# java -version</pre>
<p><figure id="attachment_6351" aria-describedby="caption-attachment-6351" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-6351" src="https://www.osradar.com/wp-content/uploads/2018/10/3-9.png" alt="3.- Showing what java version is installed" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/10/3-9.png 1366w, https://www.osradar.com/wp-content/uploads/2018/10/3-9-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/10/3-9-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/10/3-9-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/10/3-9-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/10/3-9-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/10/3-9-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-6351" class="wp-caption-text">3.- Showing what java version is installed</figcaption></figure></p>
<p>As you can see, Java was correctly installed. This was done because Apache Tomcat 9 requires at least Java 8.</p>
<h2>3. Install Apache Tomcat 9</h2>
<p>Go to the official Apache Tomcat site and download the latest stable version.</p>
<p><figure id="attachment_6352" aria-describedby="caption-attachment-6352" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-6352" src="https://www.osradar.com/wp-content/uploads/2018/10/4-5.png" alt="4.- Apache Tomcat website" width="1366" height="665" srcset="https://www.osradar.com/wp-content/uploads/2018/10/4-5.png 1366w, https://www.osradar.com/wp-content/uploads/2018/10/4-5-300x146.png 300w, https://www.osradar.com/wp-content/uploads/2018/10/4-5-768x374.png 768w, https://www.osradar.com/wp-content/uploads/2018/10/4-5-1024x499.png 1024w, https://www.osradar.com/wp-content/uploads/2018/10/4-5-696x339.png 696w, https://www.osradar.com/wp-content/uploads/2018/10/4-5-1068x520.png 1068w, https://www.osradar.com/wp-content/uploads/2018/10/4-5-863x420.png 863w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-6352" class="wp-caption-text">4.- Apache Tomcat website</figcaption></figure></p>
<p>Of course, you are working on a server, the best is to get the link directly and run:</p>
<pre class="">:~# cd /opt/
:~# wget http://ftp.wayne.edu/apache/tomcat/tomcat-9/v9.0.12/bin/apache-tomcat-9.0.12.zip</pre>
<p><figure id="attachment_6353" aria-describedby="caption-attachment-6353" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-6353" src="https://www.osradar.com/wp-content/uploads/2018/10/5-6.png" alt="5.- Downloading Apache Tomcat" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/10/5-6.png 1366w, https://www.osradar.com/wp-content/uploads/2018/10/5-6-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/10/5-6-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/10/5-6-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/10/5-6-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/10/5-6-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/10/5-6-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-6353" class="wp-caption-text">5.- Downloading Apache Tomcat</figcaption></figure></p>
<p>Now proceed to decompress it.</p>
<pre class="">:~# unzip apache-tomcat-9.0.12.zip</pre>
<p><figure id="attachment_6354" aria-describedby="caption-attachment-6354" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-6354" src="https://www.osradar.com/wp-content/uploads/2018/10/6-5.png" alt="6.- Unzipping the file" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/10/6-5.png 1366w, https://www.osradar.com/wp-content/uploads/2018/10/6-5-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/10/6-5-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/10/6-5-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/10/6-5-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/10/6-5-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/10/6-5-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-6354" class="wp-caption-text">6.- Unzipping the file</figcaption></figure></p>
<p>Then, rename the decompressed file to a simpler one.</p>
<pre class="">:~# mv apache-tomcat-9.0.12 tomcat</pre>
<p>Next, you have to set the CATALINA_HOME environment variable.</p>
<pre class="">:~# echo "export CATALINA_HOME='/opt/tomcat/'" &gt;&gt; ~/.bashrc
:~# source ~/.bashrc</pre>
<p><figure id="attachment_6356" aria-describedby="caption-attachment-6356" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-6356" src="https://www.osradar.com/wp-content/uploads/2018/10/7-5.png" alt="Setting the CATALINA_HOME variable" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/10/7-5.png 1366w, https://www.osradar.com/wp-content/uploads/2018/10/7-5-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/10/7-5-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/10/7-5-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/10/7-5-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/10/7-5-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/10/7-5-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-6356" class="wp-caption-text">Setting the CATALINA_HOME variable</figcaption></figure></p>
<p>If you are going to install Apache Tomcat on a public server, then it is preferable to create a new system user to run it.</p>
<pre class="">:~# useradd -r tomcat --shell /bin/false</pre>
<p>Then, it changes the ownership of the folder to that of the new user. I named it to tomcat.</p>
<pre class="">:~# chown -R tomcat:tomcat /opt/tomcat/</pre>
<p><figure id="attachment_6357" aria-describedby="caption-attachment-6357" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-6357" src="https://www.osradar.com/wp-content/uploads/2018/10/8-5.png" alt="8.- Changing the owner of tomcat folder" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/10/8-5.png 1366w, https://www.osradar.com/wp-content/uploads/2018/10/8-5-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/10/8-5-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/10/8-5-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/10/8-5-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/10/8-5-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/10/8-5-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-6357" class="wp-caption-text">8.- Changing the owner of the tomcat folder</figcaption></figure></p>
<h2>4. Making Apache Tomcat as a service</h2>
<p>To properly handle Apache Tomcat, it is a good idea to create a file that is made by a system service. This way you can start it, restart it or stop it in a simpler way. Run:</p>
<pre class="">:~# nano /etc/systemd/system/tomcat.service</pre>
<p>And put the following:</p>
<pre class="">[Unit]
Description=Apache Tomcat 9
After=syslog.target network.target

[Service]
User=tomcat
Group=tomcat
Type=forking
Environment=CATALINA_PID=/opt/tomcat/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh
Restart=on-failure

[Install]
WantedBy=multi-user.target
</pre>
<p><figure id="attachment_6358" aria-describedby="caption-attachment-6358" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-6358" src="https://www.osradar.com/wp-content/uploads/2018/10/9-5.png" alt="9.- Making apache tomcat as a service" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/10/9-5.png 1366w, https://www.osradar.com/wp-content/uploads/2018/10/9-5-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/10/9-5-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/10/9-5-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/10/9-5-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/10/9-5-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/10/9-5-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-6358" class="wp-caption-text">9.- Making apache tomcat as a service</figcaption></figure></p>
<p>Save and close the file. Now run:</p>
<pre class="">:~# systemctl daemon-reload</pre>
<h2>5. Create an Apache Tomcat user account</h2>
<p>To access Tomcat Manager, you have to create a new user. The process is simple, you have to edit the file <code>/opt/tomcat/conf/tomcat-users.xml.</code></p>
<pre class="">:~# nano /opt/tomcat/conf/tomcat-users.xml</pre>
<p>And add the following:</p>
<pre class="">&lt;role rolename="admin-gui"/&gt;
&lt;user username="admin" password="PASSWORD" roles="manager-gui,admin-gui"/&gt;
&lt;/tomcat-users&gt;</pre>
<p><figure id="attachment_6359" aria-describedby="caption-attachment-6359" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-6359" src="https://www.osradar.com/wp-content/uploads/2018/10/10-4.png" alt="10.- Creating a new user for Apache Tomcat" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/10/10-4.png 1366w, https://www.osradar.com/wp-content/uploads/2018/10/10-4-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/10/10-4-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/10/10-4-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/10/10-4-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/10/10-4-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/10/10-4-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-6359" class="wp-caption-text">10.- Creating a new user for Apache Tomcat</figcaption></figure></p>
<p>Remember to change &#8220;PASSWORD&#8221; for your real password.</p>
<h2>6. Starting the service and accessing through a web browser</h2>
<p>Now you can start the Apache Tomcat service. Then check its status and finally access it from the web browser.</p>
<p>Now, you can start Apache Tomcat either using systemctl or from its own script.</p>
<pre class="">:~# sh /opt/tomcat/bin/startup.sh</pre>
<p><figure id="attachment_6360" aria-describedby="caption-attachment-6360" style="width: 1366px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-6360" src="https://www.osradar.com/wp-content/uploads/2018/10/11-4.png" alt="11.- Starting Apache Tomcat" width="1366" height="768" srcset="https://www.osradar.com/wp-content/uploads/2018/10/11-4.png 1366w, https://www.osradar.com/wp-content/uploads/2018/10/11-4-300x169.png 300w, https://www.osradar.com/wp-content/uploads/2018/10/11-4-768x432.png 768w, https://www.osradar.com/wp-content/uploads/2018/10/11-4-1024x576.png 1024w, https://www.osradar.com/wp-content/uploads/2018/10/11-4-696x391.png 696w, https://www.osradar.com/wp-content/uploads/2018/10/11-4-1068x600.png 1068w, https://www.osradar.com/wp-content/uploads/2018/10/11-4-747x420.png 747w" sizes="(max-width: 1366px) 100vw, 1366px" /><figcaption id="caption-attachment-6360" class="wp-caption-text">11.- Starting Apache Tomcat</figcaption></figure></p>
<p>Now go to <code>http://IP_SERVER/manage/html</code> and log in with your username and your password.</p>
<p><figure id="attachment_6361" aria-describedby="caption-attachment-6361" style="width: 1356px" class="wp-caption alignnone"><img loading="lazy" class="size-full wp-image-6361" src="https://www.osradar.com/wp-content/uploads/2018/10/12-3.png" alt="Apache Tomcat manager page" width="1356" height="634" srcset="https://www.osradar.com/wp-content/uploads/2018/10/12-3.png 1356w, https://www.osradar.com/wp-content/uploads/2018/10/12-3-300x140.png 300w, https://www.osradar.com/wp-content/uploads/2018/10/12-3-768x359.png 768w, https://www.osradar.com/wp-content/uploads/2018/10/12-3-1024x479.png 1024w, https://www.osradar.com/wp-content/uploads/2018/10/12-3-696x325.png 696w, https://www.osradar.com/wp-content/uploads/2018/10/12-3-1068x499.png 1068w, https://www.osradar.com/wp-content/uploads/2018/10/12-3-898x420.png 898w" sizes="(max-width: 1356px) 100vw, 1356px" /><figcaption id="caption-attachment-6361" class="wp-caption-text">Apache Tomcat manager page</figcaption></figure></p>
<h2>Conclusion</h2>
<p>Apache Tomcat is a vital tool for Java development and its installation is really simple on Linux and CentOS 7.</p>
<p>Let us know about you, Java programs? what is your experience with Tomcat? Did you find the tutorial easy?</p>
<p>Please spread this article through your social networks.</p>
<p>The post <a rel="nofollow" href="https://www.osradar.com/install-apache-tomcat-centos-7/">How to install Apache Tomcat on CentOS 7?</a> appeared first on <a rel="nofollow" href="https://www.osradar.com">Linux  Windows and android  Tutorials</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.osradar.com/install-apache-tomcat-centos-7/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
