<?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>JavaEE Archives - Linux Windows and android Tutorials</title>
	<atom:link href="https://www.osradar.com/tag/javaee/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.osradar.com</link>
	<description>tutorials and news and Seurity</description>
	<lastBuildDate>Thu, 11 Oct 2018 20:45:34 +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 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>
<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>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>
<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>Next, check the installed Java version.</p>
<pre class="">:~# java -version</pre>
<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>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>
<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>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>
<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>Now proceed to decompress it.</p>
<pre class="">:~# unzip apache-tomcat-9.0.12.zip</pre>
<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>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>
<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>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>
<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>
<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>
<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>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>
<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>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>
<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>Now go to <code>http://IP_SERVER/manage/html</code> and log in with your username and your password.</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>
<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>
