<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Devops]]></title><description><![CDATA[Devops]]></description><link>https://mamathab.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 14:49:01 GMT</lastBuildDate><atom:link href="https://mamathab.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Jenkins Installation and Understanding CI/CD]]></title><description><![CDATA[What is Jenkins?
Jenkins is an open-source automation server written in Java. It is widely used to automate tasks such as building, testing, and deploying applications.
Before using Jenkins, we learne]]></description><link>https://mamathab.hashnode.dev/jenkins-installation-and-understanding-ci-cd</link><guid isPermaLink="true">https://mamathab.hashnode.dev/jenkins-installation-and-understanding-ci-cd</guid><category><![CDATA[Jenkins]]></category><category><![CDATA[Installation]]></category><category><![CDATA[plugins]]></category><category><![CDATA[Tomcat]]></category><category><![CDATA[#Nexus]]></category><category><![CDATA[sonarqube]]></category><category><![CDATA[automation]]></category><category><![CDATA[Devops]]></category><category><![CDATA[ci-cd]]></category><dc:creator><![CDATA[Mamatha Bandi]]></dc:creator><pubDate>Fri, 09 Oct 2026 06:26:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/ea9c16ed-ed3c-4d25-8de4-aec7e88c3799.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>What is Jenkins?</h3>
<p>Jenkins is an open-source automation server written in Java. It is widely used to automate tasks such as building, testing, and deploying applications.</p>
<p>Before using Jenkins, we learned about Maven, Tomcat, and Nexus.</p>
<ul>
<li><p>Maven builds the application.</p>
</li>
<li><p>Tomcat deploys and runs the application.</p>
</li>
<li><p>Nexus stores and manages application artifacts.</p>
</li>
<li><p>Jenkins can automate the steps involved in this process.</p>
</li>
</ul>
<p>For example, instead of manually running build commands every time a developer changes the code, Jenkins can run the build automatically when configured to do so.</p>
<p>This is why Jenkins is an important tool in DevOps.</p>
<h3>Why do we use Jenkins?</h3>
<p>Jenkins helps teams automate repetitive tasks in software development and delivery.</p>
<p>Some advantages of Jenkins are:</p>
<ul>
<li><p>It is open source.</p>
</li>
<li><p>It has a web-based interface.</p>
</li>
<li><p>It supports many plugins to connect with other tools.</p>
</li>
<li><p>It can automate builds, tests, and deployment tasks.</p>
</li>
<li><p>It provides build results and logs that help with troubleshooting.</p>
</li>
<li><p>It supports integration with tools such as GitHub, Maven, SonarQube, Nexus, and deployment platforms.</p>
</li>
</ul>
<p>You can explore available plugins here: <a href="https://plugins.jenkins.io/">https://plugins.jenkins.io/</a></p>
<h3>What is Continuous Integration (CI)?</h3>
<p>Continuous Integration means developers frequently push code changes to a shared repository. Jenkins can automatically build the code and run tests to find problems early.</p>
<p><strong>Advantages of CI:</strong></p>
<ul>
<li><p>Finds bugs early.</p>
</li>
<li><p>Gives quick feedback.</p>
</li>
<li><p>Reduces integration problems.</p>
</li>
</ul>
<h3>What is Continuous Delivery?</h3>
<p>Continuous Delivery means the application is built, tested, and kept ready for release. Production deployment may require manual approval.</p>
<p><strong>Flow:</strong> Code → Build → Test → Approval → Production</p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/a745dbe2-144d-4138-882e-d45770e7e38d.png" alt="" style="display:block;margin:0 auto" />

<h3>What is Continuous Deployment?</h3>
<p>Continuous Deployment means every code change that passes the required automated checks is automatically deployed to production without separate manual approval.</p>
<p><strong>Flow:</strong> Code → Build → Test → Automatic Production Deployment.</p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/7c65d9ca-08e9-4e27-a8d7-8441e9aeb7c0.png" alt="" style="display:block;margin:0 auto" />

<p><strong>Simple difference:</strong></p>
<p><strong>Continuous Integration:</strong> Build and test the code.</p>
<p><strong>Continuous Delivery:</strong> The application is ready to release, but production deployment may require approval.</p>
<p><strong>Continuous Deployment:</strong> Successful changes are automatically deployed to production after passing the required checks.</p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/2549cbeb-644a-40b6-b7d4-38c8af0e6fa6.png" alt="" style="display:block;margin:0 auto" />

<h3>Jenkins Installation on AWS EC2</h3>
<h3>Prerequisites</h3>
<p>Before installing Jenkins, we need:</p>
<ul>
<li><p>An AWS EC2 instance</p>
</li>
<li><p>Amazon Linux 2023 or another supported Red Hat-based Linux distribution</p>
</li>
<li><p>Java 21</p>
</li>
<li><p>An EC2 security group that allows access to port 8080</p>
</li>
<li><p>An instance type such as <code>t2.medium</code> for this hands-on practice</p>
</li>
</ul>
<h3>1. Launch and Connect to EC2</h3>
<ol>
<li><p>Launch an EC2 instance from the AWS Console.</p>
</li>
<li><p>Select the required Linux AMI and instance type.</p>
</li>
<li><p>Connect to the instance using EC2 Instance Connect or SSH.</p>
</li>
</ol>
<p>Switch to the root user:</p>
<pre><code class="language-bash">sudo su -
</code></pre>
<h3>2. Update Packages and Install Java</h3>
<p>Update the system packages:</p>
<pre><code class="language-bash">dnf update -y
</code></pre>
<p>Install Java 21 and the required font configuration package:</p>
<pre><code class="language-bash">dnf install -y java-21-amazon-corretto fontconfig wget
</code></pre>
<p>Verify the Java installation:</p>
<pre><code class="language-bash">java -version
</code></pre>
<p><strong>Why do we need Java?</strong></p>
<p>Jenkins is a Java-based automation server, so a supported Java runtime is required to run it.</p>
<h3>3. Add the Jenkins LTS Repository</h3>
<p>Jenkins provides a Long-Term Support (LTS) release for users who prefer a stable release line with regular fixes.</p>
<p>Add the official Jenkins LTS repository:</p>
<pre><code class="language-bash">wget -O /etc/yum.repos.d/jenkins.repo \
https://pkg.jenkins.io/rpm-stable/jenkins.repo
</code></pre>
<p>Import the Jenkins signing key:</p>
<pre><code class="language-bash">rpm --import https://pkg.jenkins.io/rpm-stable/jenkins.io-2026.key
</code></pre>
<p>Update the package metadata:</p>
<pre><code class="language-bash">dnf upgrade -y
</code></pre>
<h3>4. Install Jenkins</h3>
<p>Install Jenkins:</p>
<pre><code class="language-bash">dnf install -y jenkins
</code></pre>
<p>Reload the systemd configuration:</p>
<pre><code class="language-bash">systemctl daemon-reload
</code></pre>
<h3>5. Enable and Start Jenkins</h3>
<p>Enable Jenkins to start automatically when the EC2 instance boots:</p>
<pre><code class="language-bash">systemctl enable jenkins
</code></pre>
<p>Start the Jenkins service:</p>
<pre><code class="language-bash">systemctl start jenkins
</code></pre>
<p>Check its status:</p>
<pre><code class="language-bash">systemctl status jenkins
</code></pre>
<p>Look for:</p>
<pre><code class="language-text">Active: active (running)
</code></pre>
<p>Press <code>q</code> to exit the status screen.</p>
<h3>6. Verify Jenkins</h3>
<p>Check whether Jenkins is listening on port 8080:</p>
<pre><code class="language-bash">ss -lntp | grep 8080
</code></pre>
<p>You can also check the local HTTP response:</p>
<pre><code class="language-bash">curl -I http://localhost:8080
</code></pre>
<p>If Jenkins is starting for the first time, it may take a few minutes before the web interface becomes available.</p>
<h3>7. Allow Port 8080 in AWS</h3>
<p>Open the AWS EC2 Console -&gt; Select your EC2 instance -&gt; Open its Security Group -&gt; Select <strong>Edit inbound rules</strong> -&gt; Add the 8080 Port(Jenkins default port)</p>
<p>For a public learning environment, restrict access to your own IP instead of allowing access from everywhere.</p>
<h3>8. Open Jenkins in Your Browser</h3>
<p>Find the current public IPv4 address of your EC2 instance.</p>
<p>Open this URL in your browser:</p>
<pre><code class="language-text">http://YOUR-EC2-PUBLIC-IP:8080
</code></pre>
<p>Replace <code>YOUR-EC2-PUBLIC-IP</code> with your actual EC2 public IP address.</p>
<p>The Jenkins unlock page should appear.</p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/452c3c51-aa08-4b46-b2b4-efcc60325448.png" alt="" style="display:block;margin:0 auto" />

<h3>9. Get the Initial Administrator Password</h3>
<p>Run this command on your EC2 instance:</p>
<pre><code class="language-bash">cat /var/lib/jenkins/secrets/initialAdminPassword
</code></pre>
<p>Copy the generated password and enter it on the Jenkins unlock page.</p>
<h3>10. Install Jenkins Plugins</h3>
<p>After unlocking Jenkins:</p>
<ol>
<li><p>Select <strong>Install suggested plugins</strong>.</p>
</li>
<li><p>Wait for the plugins to install.</p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/d3797148-0c37-4ee7-a113-3da0d29689b2.png" alt="" style="display:block;margin:0 auto" />
</li>
<li><p>Create your first administrator account.</p>
</li>
<li><p>Enter a username, a strong password, your full name, and email address if requested.</p>
</li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/464f4f8b-7e9f-4256-a14a-9e73974deb37.png" alt="" style="display:block;margin:0 auto" />

<ol>
<li><p>Click <strong>Save and Continue</strong>.</p>
</li>
<li><p>Click <strong>Save and Finish</strong>.</p>
</li>
<li><p>Select <strong>Start using Jenkins</strong>.</p>
</li>
</ol>
<p>Use your own practice credentials. Do not reuse example passwords in a real environment.</p>
<h3>11. Verify Jenkins Installation</h3>
<p>After logging in, you should see the Jenkins dashboard.</p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/242d26b1-b3b3-44ed-a232-03efba0da10e.png" alt="" style="display:block;margin:0 auto" />

<p>Jenkins is now ready for your initial configuration and practice.</p>
<h3>What We Learned</h3>
<p>In this setup, we installed Java and Jenkins on an EC2 instance, started Jenkins as a system service, configured network access, and completed the initial web-based setup.</p>
<p>In the next step, we can explore the Jenkins dashboard and create our first job.</p>
]]></content:encoded></item><item><title><![CDATA[Nexus Repository Manager Installation and Basic Setup]]></title><description><![CDATA[What is Nexus?
Nexus is a repository manager used to store and manage build artifacts. When we build a Java application using Maven, it creates files such as:

JAR

WAR

EAR


These files are called a]]></description><link>https://mamathab.hashnode.dev/nexus-repository-manager-installation-and-basic-setup</link><guid isPermaLink="true">https://mamathab.hashnode.dev/nexus-repository-manager-installation-and-basic-setup</guid><category><![CDATA[Devops]]></category><category><![CDATA[#Nexus]]></category><category><![CDATA[ci-cd]]></category><category><![CDATA[Jenkins]]></category><category><![CDATA[Devops articles]]></category><category><![CDATA[DevOps Journey]]></category><category><![CDATA[automation]]></category><dc:creator><![CDATA[Mamatha Bandi]]></dc:creator><pubDate>Thu, 08 Oct 2026 14:01:56 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/78dc83ed-3dfa-499d-b454-c2d553eddccc.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>What is Nexus?</h3>
<p>Nexus is a repository manager used to store and manage build artifacts. When we build a Java application using Maven, it creates files such as:</p>
<ul>
<li><p>JAR</p>
</li>
<li><p>WAR</p>
</li>
<li><p>EAR</p>
</li>
</ul>
<p>These files are called artifacts.</p>
<ul>
<li><p>Nexus provides a central place to store these artifacts so that developers and build servers can upload, download, and manage them.</p>
</li>
<li><p>Nexus can also be used to store other types of artifacts, such as Docker images and libraries.</p>
</li>
<li><p>Nexus is an open-source repository management tool developed by Sonatype.</p>
</li>
<li><p>It is Java-based, which means Nexus is developed using Java.</p>
</li>
</ul>
<h3>Why do we need Nexus?</h3>
<p>Nexus is used to store and maintain different versions of our application artifacts, such as WAR and JAR files.</p>
<p>For example, suppose we release version <code>1.0</code> of an application. Later, we release version <code>1.1</code>.</p>
<p>If the new version has an issue and it affects users, we should be able to quickly go back to the previous working version.</p>
<p>Nexus keeps these versions safely, so we can use a previous version when needed.</p>
<p>This is especially useful during deployments because we always have a known version that we can go back to if something goes wrong.</p>
<h3>Repository Tools</h3>
<p>There are different tools available for managing repositories.<br />Two commonly used tools are:</p>
<ol>
<li><p>Sonatype Nexus Repository</p>
</li>
<li><p>JFrog Artifactory</p>
</li>
</ol>
<p>In this article, we are working with Sonatype Nexus Repository.</p>
<h3><strong>1. Install Java</strong></h3>
<p>Tomcat requires Java to run because Tomcat is developed using Java.</p>
<pre><code class="language-plaintext">sudo dnf search java

sudo dnf install java-21-amazon-corretto-devel -y

java -version
javac -version
</code></pre>
<p>If Java is installed correctly, we can see the Java version</p>
<h3><strong>2. Install required tools</strong></h3>
<p>I need <code>wget</code> to download Tomcat, <code>unzip</code> to extract it and <code>tree</code> to see the directory structure.</p>
<pre><code class="language-plaintext">sudo dnf install wget unzip tree -y
</code></pre>
<h3><strong>3. Download and install Nexus</strong></h3>
<p>For the Nexus installation, always get the download link from the <strong>Sonatype Nexus Documentation</strong>. Older Nexus versions may not be compatible with newer Java versions.</p>
<p><strong>Tip:</strong> Choose the required version from the official page instead of using an old download link from a tutorial.</p>
<p>Go to <code>/opt</code> and download Nexus.</p>
<p>Download the Nexus archive.</p>
<pre><code class="language-plaintext">wget https://download.sonatype.com/nexus/3/nexus-3.96.4-01-linux-x86_64.tar.gz
tar -xvzf nexus-3.96.4-01-linux-x86_64.tar.gz
mv nexus-3.96.4-01 nexus
</code></pre>
<p>Now our Nexus installation directory is:</p>
<pre><code class="language-plaintext">/opt/nexus
</code></pre>
<blockquote>
<p>NOTE: As a good security practice, Nexus is not advised to run nexus service as a root user, so create a new user called nexus and grant sudo access to manage nexus services as follows.</p>
</blockquote>
<h3>4. Create a Nexus User</h3>
<p>We should not run Nexus as the root user.<br />Instead, we create a separate user called <code>nexus</code>.</p>
<pre><code class="language-plaintext">useradd --create-home nexus
</code></pre>
<p>Now we have a separate user for running the Nexus service.</p>
<h3>5. Create the Sonatype work directory</h3>
<pre><code class="language-plaintext">mkdir -p /opt/sonatype-work
</code></pre>
<p>This directory is used for Nexus working data.</p>
<h3>6. Change ownership and permissions</h3>
<p>Give the <code>nexus</code> user ownership of the Nexus directories.</p>
<pre><code class="language-plaintext">chown -R nexus:nexus /opt/nexus
chown -R nexus:nexus /opt/sonatype-work
chmod -R 775 /opt/nexus
chmod -R 775 /opt/sonatype-work
</code></pre>
<p>Now the Nexus user can access these directories.</p>
<h3>7. Configure the Nexus user</h3>
<p>Open Nexus configuration file /opt/nexus/bin/nexus.rc and uncomment run_as_user parameter and set as nexus user.</p>
<pre><code class="language-plaintext">vi /opt/nexus/bin/nexus.rc
</code></pre>
<p>Add:</p>
<pre><code class="language-plaintext">run_as_user="nexus"
</code></pre>
<p>This tells Nexus to run using the <code>nexus</code> user instead of root.</p>
<h3>8. Create the service file</h3>
<pre><code class="language-plaintext">vi /etc/systemd/system/nexus.service
</code></pre>
<p>Add the following:</p>
<pre><code class="language-plaintext">[Unit]
Description=Nexus Repository
After=network.target

[Service]
Type=forking
LimitNOFILE=65536
User=nexus
Group=nexus
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
Restart=on-abort
TimeoutStartSec=600

[Install]
WantedBy=multi-user.target
</code></pre>
<p>Here we are telling Linux how to start and stop Nexus.<br />The important parts are:</p>
<pre><code class="language-plaintext">User=nexus
Group=nexus
</code></pre>
<p>Nexus will run as the <code>nexus</code> user.</p>
<pre><code class="language-plaintext">ExecStart=/opt/nexus/bin/nexus start
</code></pre>
<p>This starts Nexus.</p>
<pre><code class="language-plaintext">ExecStop=/opt/nexus/bin/nexus stop
</code></pre>
<p>This stops Nexus.</p>
<h3>8. Create nexus as a service</h3>
<pre><code class="language-plaintext">ln -s /opt/nexus/bin/nexus /etc/init.d/nexus
</code></pre>
<h3>9. Reload &amp; start the nexus service</h3>
<p>After creating the service file, reload systemd.</p>
<pre><code class="language-plaintext">su - nexus
systemctl daemon-reload
systemctl enable nexus
systemctl start nexus
systemctl status nexus
</code></pre>
<p>Check port <code>8080</code>:</p>
<pre><code class="language-plaintext">ss -lntp | grep 8081
</code></pre>
<p>If Nexus is running, port <code>808</code>1 should be listening.<br />We can also test Nexus locally:</p>
<pre><code class="language-plaintext">curl -I http://localhost:8081
</code></pre>
<p>If Nexus is running correctly, we should get an HTTP response.</p>
<h3><strong>10.</strong> Access Nexus from the Browser</h3>
<p>Open the browser:</p>
<pre><code class="language-plaintext">http://&lt;EC2-PUBLIC-IP&gt;:8081
</code></pre>
<p>You should see the Sonatype Nexus page.<br /><em><strong>Note:</strong></em> Enable port 8081 in the Security Group inbound rules.</p>
<h3>Get the Initial Admin Password</h3>
<p>When we open Nexus for the first time, we need the initial admin password.</p>
<p>The password is stored in:</p>
<pre><code class="language-plaintext">/opt/sonatype-work/nexus3/admin.password
</code></pre>
<p>Run:</p>
<pre><code class="language-plaintext">cat /opt/sonatype-work/nexus3/admin.password
</code></pre>
<p>The command displays the initial password.<br />Use the initial password to login For example:</p>
<pre><code class="language-plaintext">admin
&lt;initial-password&gt;
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/34bbe532-caf5-4df1-9cc4-8466a0e40de1.png" alt="" style="display:block;margin:0 auto" />

<h3>Set a New Admin Password</h3>
<p>After logging in for the first time, Nexus asks us to change the initial password.</p>
<p>Set a new password for the <code>admin</code> user.</p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/04dc42f0-99b9-4882-b91e-b060003adb8a.png" alt="" style="display:block;margin:0 auto" />

<p>After setting the password, continue to the Nexus interface.</p>
<h3>Nexus Dashboard</h3>
<p>After logging in, we can see the Nexus Repository Manager dashboard.</p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/4729ea7e-dbf7-4a91-8d24-d21e788efdc8.png" alt="" style="display:block;margin:0 auto" />

<p>From here, we can manage repositories and other Nexus settings.</p>
<h3>Nexus Repositories</h3>
<p>Nexus repositories are commonly separated based on the stage of the application.</p>
<ul>
<li><p><strong>Snapshot repository</strong> is used for development, testing, and staging builds.</p>
</li>
<li><p><strong>Release repository</strong> is used for stable versions that are ready for production.</p>
</li>
</ul>
<p>So the simple flow is:</p>
<p><strong>Development → Testing/Staging → Release → Production</strong></p>
<p>If a production release causes a problem, we can use the previously stored stable version instead of building the application again from the beginning.</p>
<h3>Create a Snapshot Repository</h3>
<p>Now let's create our first repository.<br />We will create a Maven hosted repository for snapshot artifacts.<br /><code>login as a admin --&gt; settings --&gt; create repository --&gt; maven2(hosted)</code></p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/d85133ba-e135-453e-9666-065a58986fe3.png" alt="" style="display:block;margin:0 auto" />

<p><code>give name as jio-snapshot --&gt; select version policy [snapshot] --&gt; scroll down ---&gt; create repository.</code></p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/84708695-82eb-4a04-9e1c-2c8f2c3ddb64.png" alt="" style="display:block;margin:0 auto" />

<p>During development, developers may build the application many times.</p>
<p>For example:</p>
<pre><code class="language-plaintext">1.0-SNAPSHOT
</code></pre>
<p>The application is still under development, so we can store these development artifacts in a snapshot repository.</p>
<ul>
<li>For each project we are going to create two types of repositories.</li>
</ul>
<pre><code class="language-plaintext">  1. jio-snapshot
  2. jio-release
</code></pre>
<p><strong>Create the Release repository same as Snapshot</strong></p>
<p>A release repository is used for stable versions of an application.</p>
<p><code>settings --&gt; create repository --&gt; maven2(hosted)--&gt; give name as jio-release --&gt; select version policy [release] --&gt; scroll down ---&gt; create repository.</code></p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/a5f68da0-5b08-45d9-870a-6d37a8030e25.png" alt="" style="display:block;margin:0 auto" />

<h3>Nexus Repository URLs</h3>
<p>Each repository has its own URL. For example, we have two repositories:</p>
<p><strong>Release repository</strong></p>
<p><code>http://15.207.116.105:8081/repository/jio-release/</code></p>
<p><strong>Snapshot repository</strong></p>
<p><a href="http://3.108.185.164:8090/repository/jio-snapshot-repo/"><code>http://15.207.116.105:8081/repository/jio-snapshot/</code></a></p>
<p>These URLs are used when we connect Maven with Nexus.</p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/5ac4f38a-d8e6-4b4c-9d52-4545af0155bc.png" alt="" style="display:block;margin:0 auto" />

<h3>How to Integrate Nexus with Maven?</h3>
<p>Now that Nexus is ready, we can connect it with Maven.</p>
<p>The Maven server and Nexus server are <strong>two different servers</strong>.</p>
<p>The Java project and Maven are available on the Maven server, while Nexus is running on the Nexus server.</p>
<p>The basic flow is:</p>
<p><strong>Java Project → Maven Build → Nexus Repository</strong></p>
<h3>Step 1: Go to the Maven server</h3>
<p>First, connect to the server where the Java project is available.</p>
<p>Go to the project directory where the <code>pom.xml</code> file is present.</p>
<h3>Step 2: Add Nexus repository details</h3>
<p>We need to tell Maven where it should upload the generated artifact.</p>
<p>For this, we add the Nexus repository details in the project's <code>pom.xml</code>.</p>
<p>Add:</p>
<pre><code class="language-plaintext">&lt;repository&gt;
    &lt;id&gt;nexus&lt;/id&gt;
    &lt;name&gt;Releases Nexus Repository&lt;/name&gt;
    &lt;url&gt;http://15.207.116.105:8081/repository/jio-release/&lt;/url&gt;
&lt;/repository&gt;

&lt;snapshotRepository&gt;
    &lt;id&gt;nexus&lt;/id&gt;
    &lt;name&gt;Snapshot Nexus Repository&lt;/name&gt;
    &lt;url&gt;http://15.207.116.105:8081/repository/jio-snapshot/&lt;/url&gt;
&lt;/snapshotRepository&gt;
</code></pre>
<p>Here we are providing two repository URLs:</p>
<ul>
<li><p>repository → Release repository</p>
</li>
<li><p>snapshotRepository → Snapshot repository</p>
</li>
</ul>
<p>So Maven knows where to upload release and snapshot versions.</p>
<h3>Step 3: Configure Nexus credentials</h3>
<p>Now Maven also needs credentials to connect to Nexus.</p>
<p>We don't keep the Nexus password directly in pom.xml.</p>
<p>The Nexus credentials are configured in Maven's settings.xml.</p>
<p>On the Maven server,<br />open:</p>
<pre><code class="language-plaintext">vi /opt/apache-maven-3.9.10/conf/settings.xml
</code></pre>
<p>Add: nexus admin password</p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/82fe423d-3729-4597-bd83-f3d18a57b88a.png" alt="" style="display:block;margin:0 auto" />

<p>The important point here is that the must match the ID in pom.xml.</p>
<p>So:</p>
<p><strong>pom.xml → Repository details</strong></p>
<p><strong>settings.xml → Nexus credentials</strong></p>
<p>The <code>settings.xml</code> file is configured on the <strong>Maven server</strong>, not on the Nexus server.</p>
<h3>Step 4: Deploy the artifact to Nexus</h3>
<p>Now go to the project directory where <code>pom.xml</code> is available.</p>
<p>Run:</p>
<pre><code class="language-plaintext">mvn clean deploy
</code></pre>
<p>Maven will build the project and deploy the generated artifact to the configured Nexus repository.</p>
<p>For a snapshot version, the artifact will be uploaded to the <strong>Snapshot repository</strong>.</p>
<p>If we run:</p>
<pre><code class="language-plaintext">mvn clean deploy
</code></pre>
<p>multiple times with a snapshot version, Maven can upload updated snapshot builds to the snapshot repository.</p>
<h3>Simple Flow</h3>
<p>The complete process is:</p>
<pre><code class="language-plaintext">
 👨‍💻 Developer
       |
       | Push Code
       v
   ┌─────────┐
   │ GitHub  │
   └─────────┘
       |
       | git clone
       v
   ┌─────────┐
   │ Maven   │
   └─────────┘
       |
       | mvn clean package
       |
       +------------------------+
       |                        |
       v                        |
 ┌───────────────┐              |
 │ WAR/JAR/EAR   │              |
 │ Generated     │              |
 └───────────────┘              |
       |                        |
       | mvn deploy             |
       v                        |
 ┌───────────────┐              |
 │ Nexus         │◄-------------+
 │ Repository    │
 │ Store Artifact│
 └───────────────┘
       |
       | Download Artifact
       v
 ┌───────────────┐
 │ Apache Tomcat │
 │ Deploy WAR    │
 └───────────────┘
</code></pre>
<p>This is the basic integration between Maven and Nexus.</p>
<h2>Conclusion</h2>
<p>As of now, we are manually running the Maven goal when we need to build and deploy the application.</p>
<p>For example:</p>
<pre><code class="language-plaintext">mvn clean deploy
</code></pre>
<p>This builds the application and uploads the artifact to the Nexus repository.</p>
<p>In the next blogs, we will start <strong>automating this process</strong> so that we don't have to manually run these commands every time.</p>
<p>We will move towards <strong>Jenkins and CI/CD automation</strong>, where the build and deployment process can be triggered automatically.</p>
]]></content:encoded></item><item><title><![CDATA[Maven Installation and Setup]]></title><description><![CDATA[What is Maven?
Maven is a build tool mainly used for Java projects. It helps us to:

Build the Java project

Download and manage dependencies

Run tests

Create the final WAR or JAR file


Maven is an]]></description><link>https://mamathab.hashnode.dev/maven-installation-and-setup</link><guid isPermaLink="true">https://mamathab.hashnode.dev/maven-installation-and-setup</guid><category><![CDATA[Devops]]></category><category><![CDATA[ci-cd]]></category><category><![CDATA[maven]]></category><category><![CDATA[Jenkins]]></category><category><![CDATA[#Nexus]]></category><category><![CDATA[ Jenkins, DevOps]]></category><category><![CDATA[Tomcat]]></category><category><![CDATA[sonarqube]]></category><dc:creator><![CDATA[Mamatha Bandi]]></dc:creator><pubDate>Thu, 08 Oct 2026 11:27:50 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/458a9019-dc19-4126-a1fb-0bf3ea174bb1.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>What is Maven?</h3>
<p>Maven is a build tool mainly used for Java projects. It helps us to:</p>
<ul>
<li><p>Build the Java project</p>
</li>
<li><p>Download and manage dependencies</p>
</li>
<li><p>Run tests</p>
</li>
<li><p>Create the final WAR or JAR file</p>
</li>
</ul>
<p>Maven is an open-source tool developed by the Apache Software Foundation.</p>
<p><strong>Why do we need Maven?</strong></p>
<p>Maven helps developers manage dependencies, compile code, run tests, and generate WAR/JAR files.</p>
<p>When a developer writes Java code, we need to convert that source code into a package that can be used or deployed.</p>
<p>For example:</p>
<pre><code class="language-plaintext">Developer
   ↓
Java Code
   ↓
Maven
   ↓
WAR / JAR
   ↓
Tomcat -&gt;Deploy
</code></pre>
<p>Instead of doing the build steps manually, Maven does them for us.</p>
<h3><strong>1. Install Java</strong></h3>
<p>Maven requires Java to run because Maven is developed using Java.</p>
<pre><code class="language-plaintext">sudo dnf search java

sudo dnf install java-21-amazon-corretto-devel -y

java -version
javac -version
</code></pre>
<p>If Java is installed correctly, we can see the Java version.</p>
<h3><strong>2. Install required tools</strong></h3>
<p>I need <code>wget</code> to download Maven, <code>unzip</code> to extract it and <code>tree</code> to see the directory structure.</p>
<pre><code class="language-plaintext">sudo dnf install wget unzip tree -y
</code></pre>
<h3><strong>3. Download and install Maven</strong></h3>
<p>For the Tomcat installation, always get the download link from the <strong>official Apache Tomcat documentation</strong>. Older Tomcat versions may not be compatible with newer Java versions.</p>
<p>You can find the latest Tomcat 9 downloads here:</p>
<p><a href="https://maven.apache.org/download.cgi">Apache Maven 3 Downloads</a></p>
<p><strong>Tip:</strong> Choose the required version from the official page instead of using an old download link from a tutorial.<br />Go to <code>/opt</code> and download Tomcat.</p>
<pre><code class="language-plaintext">sudo su -

wget https://dlcdn.apache.org/maven/maven-3/3.9.16/binaries/apache-maven-3.9.16-bin.zip

unzip apache-maven-3.9.16-bin.zip
</code></pre>
<h3>4. Set the Maven environment variables.</h3>
<p>Open the <code>~/.bash_profile</code> file</p>
<pre><code class="language-plaintext">vi ~/.bash_profile
</code></pre>
<p>Add:</p>
<pre><code class="language-plaintext">export M2_HOME=/opt/apache-maven-3.9.16
export PATH=$PATH:$M2_HOME/bin
</code></pre>
<p>Load the changes:</p>
<pre><code class="language-plaintext">source ~/.bash_profile
</code></pre>
<p>Check Maven:</p>
<pre><code class="language-plaintext">mvn -version
</code></pre>
<p>You should see the Maven version.</p>
<h3>5. Maven Directory Structure</h3>
<p>We can use the <code>tree</code> command to see the Maven directories.</p>
<pre><code class="language-plaintext">cd /opt/apache-maven-3.9.16

tree -L 2
</code></pre>
<p>The important directories are:</p>
<pre><code class="language-plaintext">bin/
boot/
conf/
lib/
</code></pre>
<p><code>bin/</code> contains binary files [<code>mvn</code>, etc]</p>
<p><code>boot/</code> contains <code>jar</code> files used at runtime</p>
<p><code>conf/</code> contains Maven configuration files such as <code>settings.xml</code>.</p>
<p><code>lib/</code> contains Maven libraries[<code>jars</code> files]</p>
<p><em><strong>default xml file names for build scripts</strong></em></p>
<p><em><strong>pom.xml</strong></em> ----&gt; maven<br />build.xml ---&gt;ant<br />build.gradle[we can not use xml for gradle] ---&gt;gradle</p>
<h3>6. Maven Lifecycle</h3>
<p>Maven has three main lifecycles:</p>
<pre><code class="language-plaintext">clean
default
site
</code></pre>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/6d531b9f-f992-4ab9-9d73-f592a74e195e.png" alt="" style="display:block;margin:0 auto" />

<h3>6.1 Clean</h3>
<p>The clean lifecycle handles project cleaning. It consists of the following <strong>phases:<br /><em>pre-clean:</em></strong><br /><em><strong>clean:</strong></em> It will delete the build history --&gt; delete the target dir.<br /><em><strong>post-clean:</strong></em><br /><strong>Ex:</strong></p>
<pre><code class="language-plaintext">mvn clean
</code></pre>
<p>It removes the <code>target</code> directory.</p>
<h3>6.2 Site</h3>
<p>The site lifecycle handles the creation of the project's site documentation. It consists of the following phases:</p>
<p><em><strong>pre-site:</strong></em> Executes processes needed before the actual project site generation.<br /><em><strong>site:</strong></em> Generates the project's site documentation.<br /><em><strong>post-site:</strong></em> Executes processes needed to finalize the site generation.<br /><em><strong>site-deploy:</strong></em> Deploys the generated site documentation to the specified web server.<br /><strong>Ex:</strong></p>
<pre><code class="language-plaintext">mvn site
</code></pre>
<blockquote>
<p>NOTE: Now a days developers are using Swagger instead of site goal.</p>
</blockquote>
<h3>6.3 Default</h3>
<p><em><strong>validate</strong></em> - validate the project is correct and all necessary information is available like directory structure, etc<br /><em><strong>compile -</strong></em> compile the source code of the project<br /><em><strong>test -</strong></em> test the compiled source code using a suitable unit testing framework[junit] and checks the unit test cases.</p>
<p>NOTE: These tests should not require the code be packaged or deployed</p>
<p><em><strong>package -</strong></em> take the compiled code and and generate the package, such as a jar/war/ear.<br /><em><strong>install -</strong></em> install the package[jar/war/ear] into the local repository, for use as a dependency in other projects locally.<br /><em><strong>deploy -</strong></em> done in the build environment, copies the final package[jar/war/ear] to the remote repository for sharing with other developers and projects.<br /><strong>Ex:</strong></p>
<pre><code class="language-plaintext">mvn clean
mvn validate
mvn compile
mvn test
mvn package
mvn verify
mvn install
mvn deploy
</code></pre>
<p><em><strong>Is it possible to pass two goals at a time?</strong></em></p>
<pre><code class="language-plaintext">mvn clean package
</code></pre>
<p>First it will clean (delete the previous target directory) then build the package again.</p>
<h3>7. Maven Repositories</h3>
<p>Maven repositories are locations where Maven artifacts (JAR files, plugins, and other project dependencies) are stored and can be retrieved from.</p>
<p>There are three repositories we need to understand.</p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/20da6977-3598-49ee-82ff-f430d8d3c764.png" alt="" style="display:block;margin:0 auto" />

<p><strong>7.1 Local Repository</strong></p>
<p>The local repository is a directory on your local machine where Maven stores downloaded artifacts. By default, it is located in the .m2 directory within the user's home directory.<br />By default:</p>
<pre><code class="language-plaintext">~/.m2/repository
</code></pre>
<p>Maven stores downloaded dependencies here.</p>
<p>To change the default location:<br /><em><strong>step 1:</strong></em><br />open <code>/opt/apache-maven-3.9.10/conf/settings.xml</code></p>
<p><em><strong>step 2:</strong></em><br />update under settings tag</p>
<pre><code class="language-plaintext">&lt;localRepository&gt;
/root/commonrepo
&lt;localRepository&gt;
</code></pre>
<p><strong>7.2 Central Repository</strong></p>
<p>Maven Central is a public repository that contains many commonly used Java libraries. hosted by the Maven community</p>
<p>If Maven cannot find a dependency in the local repository, it can download it from Maven Central.</p>
<p><strong>7.3 Remote Repository</strong></p>
<p>In a organization, We have 5 war files, every one Don't keep in the central repo, an access, so we are keeping in remote repo so company people can access.</p>
<pre><code class="language-plaintext">Nexus
JFrog
</code></pre>
<p>These are used to store the organization's WAR, JAR and other artifacts.</p>
<p>We will discuss Nexus in the next blog.</p>
<h3>8. Build the Application</h3>
<p>Now clone the project and go to the directory where <code>pom.xml</code> is present.</p>
<p><code>pom.xml</code> is the main Maven configuration file for the project.</p>
<p>Run:</p>
<pre><code class="language-plaintext">mvn clean package
</code></pre>
<p>Maven builds the project and creates the <code>target</code> directory.</p>
<p>Inside the <code>target</code> directory, we can see the generated WAR file.</p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/b3c2b533-b90e-4bbb-887f-f4406103f6ec.png" alt="" style="display:block;margin:0 auto" />

<p>For example:</p>
<pre><code class="language-plaintext">target/
└── maven-web-application.war
</code></pre>
<p>This WAR file can then be deployed to <strong>Tomcat</strong>.</p>
<blockquote>
<p><code>Later, we can use Jenkins to automate the Maven build whenever new code is pushed.</code></p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Tomcat Installation and Basic Setup]]></title><description><![CDATA[When we learn DevOps, we usually see tools like Maven, SonarQube, Nexus and Jenkins.
A simple flow is:
Developer → Git → Maven → SonarQube → Nexus → Tomcat
Later, we use Jenkins to automate this compl]]></description><link>https://mamathab.hashnode.dev/tomcat-installation-and-basic-setup</link><guid isPermaLink="true">https://mamathab.hashnode.dev/tomcat-installation-and-basic-setup</guid><category><![CDATA[Devops]]></category><category><![CDATA[Tomcat]]></category><category><![CDATA[Jenkins]]></category><category><![CDATA[ Jenkins, DevOps]]></category><category><![CDATA[ci-cd]]></category><category><![CDATA[automation]]></category><category><![CDATA[deployment]]></category><dc:creator><![CDATA[Mamatha Bandi]]></dc:creator><pubDate>Wed, 07 Oct 2026 12:08:26 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/9884bf32-3653-44e2-8f59-e9e60630c976.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When we learn DevOps, we usually see tools like <strong>Maven, SonarQube, Nexus and Jenkins</strong>.</p>
<p><strong>A simple flow is</strong>:</p>
<p><strong>Developer → Git → Maven → SonarQube → Nexus → Tomcat</strong></p>
<p>Later, we use <strong>Jenkins</strong> to automate this complete process.<br />Before automation, I want to understand how Tomcat works manually. So in this blog, let's install Tomcat and understand its basic directory structure, users, deployment and port configuration.</p>
<h3>What is Tomcat?</h3>
<p>Apache Tomcat is a Java application server used to deploy and run Java web applications (.war files).</p>
<p>In many organizations, developers build applications and deploy them to Tomcat servers.<br />Today, let's install and understand Tomcat.</p>
<p><strong>1. Install Java</strong><br />Tomcat requires Java to run because Tomcat is developed using Java.</p>
<pre><code class="language-plaintext">sudo dnf search java

sudo dnf install java-21-amazon-corretto-devel -y

java -version
javac -version
</code></pre>
<p>If Java is installed correctly, we can see the Java version.</p>
<h3><strong>2. Install required tools</strong></h3>
<p>I need <code>wget</code> to download Tomcat, <code>unzip</code> to extract it and <code>tree</code> to see the directory structure.</p>
<pre><code class="language-plaintext">sudo dnf install wget unzip tree -y
</code></pre>
<h3><strong>3. Download and install Tomcat</strong></h3>
<p>For the Tomcat installation, always get the download link from the <strong>official Apache Tomcat documentation</strong>. Older Tomcat versions may not be compatible with newer Java versions.</p>
<p>You can find the latest Tomcat 9 downloads here:</p>
<p><a href="https://tomcat.apache.org/download-90.cgi">Apache Tomcat 9 Downloads</a></p>
<p><strong>Tip:</strong> Choose the required version from the official page instead of using an old download link from a tutorial.</p>
<p>Go to <code>/opt</code> and download Tomcat.</p>
<pre><code class="language-plaintext">sudo su -

cd /opt

wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.122/bin/apache-tomcat-9.0.122.zip

unzip apache-tomcat-9.0.122.zip

cd apache-tomcat-9.0.122/bin
</code></pre>
<p>Give execute permission to the shell scripts:</p>
<pre><code class="language-plaintext">chmod u+x *.sh
</code></pre>
<h3><strong>4. Start Tomcat</strong></h3>
<p>Start Tomcat using:</p>
<pre><code class="language-plaintext">sh catalina.sh start
</code></pre>
<p>Check whether Tomcat is running:</p>
<pre><code class="language-plaintext">ps -ef | grep tomcat
</code></pre>
<p>Check the Tomcat logs:</p>
<pre><code class="language-plaintext">tail -f /opt/apache-tomcat-9.0.122/logs/catalina.out
</code></pre>
<p>Check port <code>8080</code>:</p>
<pre><code class="language-plaintext">ss -lntp | grep 8080
</code></pre>
<p>If Tomcat is running, port <code>8080</code> should be listening.</p>
<h3>5. Tomcat directory structure</h3>
<p>The <code>tree</code> command helps us understand the Tomcat folders.</p>
<pre><code class="language-plaintext">cd /opt/apache-tomcat-9.0.122

tree -L 2
</code></pre>
<p>The important directories are:</p>
<pre><code class="language-plaintext">apache-tomcat-9.0.122/
│
├── bin/
├── conf/
├── lib/
├── logs/
├── temp/
├── webapps/
└── work/
</code></pre>
<p><strong>What are these folders?</strong></p>
<p><strong>bin/</strong><br />Contains scripts used to start and stop Tomcat.</p>
<pre><code class="language-plaintext">startup.sh
shutdown.sh
catalina.sh
</code></pre>
<p><a href="http://catalina.sh"><code>catalina.sh</code></a> is the main script used to control Tomcat.</p>
<p><strong>conf/</strong><br />Contains Tomcat configuration files.</p>
<pre><code class="language-plaintext">server.xml
tomcat-users.xml
</code></pre>
<p><code>server.xml</code> → server and port configuration.</p>
<p><code>tomcat-users.xml</code> → users and roles.</p>
<p><strong>lib/</strong><br />Contains Tomcat <code>.jar</code> files.</p>
<p><strong>logs/</strong><br />Contains Tomcat log files.</p>
<p><strong>webapps/</strong><br />This is where web applications are deployed.</p>
<p>For example:</p>
<pre><code class="language-plaintext">ROOT
manager
host-manager
</code></pre>
<p><strong>temp/</strong><br />Used for temporary files.</p>
<p><strong>work/</strong><br />Contains files generated while Tomcat processes applications.</p>
<h3>6. Access Tomcat</h3>
<p>Open the browser:</p>
<pre><code class="language-plaintext">http://&lt;EC2-PUBLIC-IP&gt;:8080
</code></pre>
<p>You should see the Tomcat page.<br /><em><strong>Note:</strong></em> Enable port 8080 in the Security Group inbound rules.</p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/9ef8df9d-b0db-4a83-8ab8-f856bceca06e.png" alt="" style="display:block;margin:0 auto" />

<h3>7. Tomcat Manager App</h3>
<p>Tomcat provides a <strong>Manager App</strong> to manage applications.</p>
<p>Click:</p>
<p><strong>Manager App</strong></p>
<p>Initially, it may ask for username and password.</p>
<p>To enable access, go to:</p>
<pre><code class="language-plaintext">cd /opt/apache-tomcat-9.0.122/webapps/manager/META-INF

vi context.xml
</code></pre>
<p>In <code>context.xml</code>, comment the relevant <code>RemoteAddrValve</code> lines.</p>
<p>:se nu =&gt; comment 21st and 22nd lines.</p>
<pre><code class="language-plaintext">&lt;!--
...(21st and 22nd line)
--&gt;
</code></pre>
<p><strong>Screenshot:</strong> <code>context.xml</code> before/after commenting</p>
<h3>8. Create Tomcat user</h3>
<p>Now go to:</p>
<pre><code class="language-plaintext">cd /opt/apache-tomcat-9.0.122/conf

vi tomcat-users.xml
</code></pre>
<p>Add a user and required roles before the closing <code>tomcat-users</code> tag.</p>
<p>Example:</p>
<pre><code class="language-plaintext">&lt;user username="mamatha" password="password" roles="manager-gui,admin-gui"/&gt;
&lt;user username="tomcat" password="password" roles="manager-gui,admin-gui"/&gt;
</code></pre>
<p>Save the file.</p>
<p>Now open the <strong>Manager App</strong> again and enter the username and password.</p>
<blockquote>
<p>For a real production server, use a strong password and follow your organization's access/security rules. Don't use simple demo credentials.</p>
</blockquote>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/3bb4620f-54d1-4ee6-8ddc-da258e64fba2.png" alt="" style="display:block;margin:0 auto" />

<p>Manager App after successful login<br />Tomcat UI shows the message <em><strong>ok</strong></em></p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/ab80a54a-c1d1-4fb6-9308-d55b3bf0d43e.png" alt="" style="display:block;margin:0 auto" />

<h3>9. Host Manager</h3>
<p>We can configure the <strong>Host Manager</strong> in a similar way.</p>
<p>Go to:</p>
<pre><code class="language-plaintext">cd /opt/apache-tomcat-9.0.122/webapps/host-manager/META-INF

ls
</code></pre>
<p>You will see:</p>
<pre><code class="language-plaintext">context.xml
</code></pre>
<p>Edit it:</p>
<pre><code class="language-plaintext">vi context.xml
</code></pre>
<p>Comment the relevant access restriction lines.<br />Then open:</p>
<p><strong>Host Manager</strong><br />and provide the Tomcat credentials.</p>
<h3>10. Check Tomcat logs</h3>
<p>Tomcat creates log files under:</p>
<pre><code class="language-plaintext">cd /opt/apache-tomcat-9.0.122/logs

ls
</code></pre>
<p>Some important files are:</p>
<pre><code class="language-plaintext">catalina.out
localhost_access_log...
</code></pre>
<p>When troubleshooting Tomcat, logs are one of the first places to check.</p>
<p>When troubleshooting Tomcat, logs are one of the first places I check.</p>
<h3>Deploy a WAR file</h3>
<p>One common way to deploy a Java web application is using a <code>.war</code> file.</p>
<p>We can copy the WAR file into:</p>
<pre><code class="language-plaintext">/opt/apache-tomcat-9.0.122/webapps/
</code></pre>
<p>For example:</p>
<pre><code class="language-plaintext">cp myapp.war /opt/apache-tomcat-9.0.122/webapps/
</code></pre>
<p>Tomcat detects the WAR file and deploys the application.</p>
<p>We can also deploy a WAR using the <strong>Manager App</strong>.</p>
<p>Go to:</p>
<p><strong>Manager App → Deploy → WAR file to deploy → Choose File → Deploy</strong></p>
<img src="https://cdn.hashnode.com/uploads/covers/686d39c1d15c5de72abaf85e/de8bc50f-c913-4255-9314-8df37ea9440d.png" alt="" style="display:block;margin:0 auto" />

<p>This is useful for understanding manual deployment.</p>
<p>Later, instead of manually uploading the WAR file, <strong>Jenkins can do this automatically</strong>.</p>
<h3>What if Tomcat and Jenkins use the same port?</h3>
<p>This is an important situation.</p>
<p>Suppose:</p>
<pre><code class="language-plaintext">Tomcat → 8080
Jenkins → 8080
</code></pre>
<p>Both applications cannot listen on the same port on the same server.</p>
<p>We will get a port conflict such as:</p>
<pre><code class="language-plaintext">java.net.BindException
</code></pre>
<p>So we need to change one of the ports.</p>
<p>For example:</p>
<pre><code class="language-plaintext">Tomcat → 8081
Jenkins → 8080
</code></pre>
<h3>Change Tomcat port</h3>
<p>Go to:</p>
<pre><code class="language-plaintext">cd /opt/apache-tomcat-9.0.122/conf
</code></pre>
<p>Open:</p>
<pre><code class="language-plaintext">vi server.xml
</code></pre>
<p>Find the connector port:</p>
<pre><code class="language-plaintext">&lt;Connector port="8080" ... /&gt;
</code></pre>
<p>Change it to:</p>
<pre><code class="language-plaintext">&lt;Connector port="8081" ... /&gt;
</code></pre>
<p>Stop Tomcat and start it again:</p>
<pre><code class="language-plaintext">cd /opt/apache-tomcat-9.0.122/bin

sh catalina.sh stop

sh catalina.sh start
</code></pre>
<p>Now access:</p>
<pre><code class="language-plaintext">http://&lt;EC2-PUBLIC-IP&gt;:8081
</code></pre>
<p><strong>Important:</strong> If this is an AWS EC2 instance, make sure the new port is allowed in the <strong>Security Group</strong>.</p>
<h3>Conclusion:</h3>
<p>In this blog we installed Apache Tomcat and understood how it works. This blog covers:</p>
<ul>
<li><p>Installing Java and Tomcat</p>
</li>
<li><p>Understanding the important Tomcat directories</p>
</li>
<li><p>Starting and stopping Tomcat</p>
</li>
<li><p>Accessing the Manager App and Host Manager</p>
</li>
<li><p>Creating users and roles</p>
</li>
<li><p>Deploying a WAR file</p>
</li>
<li><p>Checking Tomcat logs</p>
</li>
<li><p>Changing the Tomcat port</p>
</li>
<li><p>Understanding basic port conflicts.</p>
</li>
</ul>
<p>This gives us a basic understanding of Tomcat before moving to the next tools in the DevOps process.</p>
<p>In the next blog, we will set up <em><strong>Maven</strong></em> and understand how it is used to build a Java application.</p>
<p>Then we will continue with <em><strong>SonarQube, Nexus</strong></em> and <em><strong>Jenkins</strong></em> and finally connect them together for automation.</p>
]]></content:encoded></item></channel></rss>