Showing posts with label Tomcat. Show all posts
Showing posts with label Tomcat. Show all posts

Tuesday, June 4, 2024

Install Tomcat 10 on Ubuntu 24.0.4 | Setup Tomcat 10 on Ubuntu 24.0.4 in AWS EC2 | Setup Tomcat on Ubuntu

Tomcat is one of the popular web containers for deploying Java applications. Tomcat is open source. Click here to learn more about Tomcat. Let's see how to install Tomcat on Ubuntu 24.0.4.



Tomcat is both Web server and web container


Please follow below steps to install Tomcat 10 on Ubuntu 24.0.4.

Pre-requisites:
  • Create new EC2 instance first for setting up Tomcat. 
  • Also open port 8080 in security firewall rules for EC2 instance in AWS.
Tomcat Installation
Tomcat is a web server or web container where java web application can be deployed by developers. You can learn more about by clicking this URL.  Tomcat can be installed by executing below commands:

Change Host Name to Tomcat
sudo hostnamectl set-hostname Tomcat

Update to Latest packages
sudo apt update

Install Tomcat9
sudo apt install tomcat10 tomcat10-docs tomcat10-admin -y

Perform below command for setting up tomcat admin app
sudo cp -r /usr/share/tomcat10-admin/* /var/lib/tomcat10/webapps/ -v

Setup an user in tomcat 
Open the tomcat-users.xml file by executing below command
sudo vi /var/lib/tomcat10/conf/tomcat-users.xml

You need to edit the file, click on this link to know how to make changes using Vi editor.
We need to add tomcat user and assign to manager-script role.
Scroll down all the way to the end of the file,
Add the below lines in second last line above (above </tomcat-users>)

<role rolename="manager-script"/>
<user username="tomcat" password="password" roles="manager-script"/>


Now restart tomcat to take the changes in effect
sudo systemctl restart tomcat10

Verify if tomcat10 is working fine
sudo systemctl status tomcat10
Now press q for quitting from that window. Now open the browser to access Tomcat, enter
You should see a page that says.


That's it. You have setup Tomcat successfully!!
 

Wednesday, January 24, 2024

Install Tomcat 10 on Ubuntu 24.0.4 | Setup Tomcat 10 on Ubuntu 24.0.4 in AWS EC2 | Setup Tomcat 10 on Ubuntu

Tomcat is one of the popular web containers for deploying Java applications. Tomcat is an open source web container. Click here to learn more about Tomcat. Let's see how to install Tomcat on Ubuntu 24.0.4.



Tomcat is both Web server and web container


Please follow below steps to install Tomcat 9 on Ubuntu 24.0.4.

Pre-requisites:
  • Create new EC2 instance first for setting up Tomcat. 
  • Also open port 8080 in security firewall rules for EC2 instance in AWS.
Tomcat Installation
Tomcat is a web server or web container where java web application can be deployed by developers. You can learn more about by clicking this URL.  Tomcat can be installed by executing below commands:

Change Host Name to Tomcat
sudo hostnamectl set-hostname Tomcat

Update to Latest packages
sudo apt update

Install Tomcat9
sudo apt install tomcat10 tomcat10-admin -y

Perform below command for setting up tomcat admin app
sudo cp -r /usr/share/tomcat10-admin/* /var/lib/tomcat10/webapps/ -v

Setup an user in tomcat 
Open the tomcat-users.xml file by executing below command
sudo nano /var/lib/tomcat10/conf/tomcat-users.xml

We need to edit this file.
We need to add tomcat user and assign to manager-script role.
Scroll down all the way to the end of the file,
Add the below lines in second last line above (above </tomcat-users>)

<role rolename="manager-script"/>
<user username="tomcat" password="password" roles="manager-script"/>


Press Control O and enter for saving the file. 
Press Control + X for exiting the file after saving.

Now restart tomcat to take the changes in effect
sudo systemctl restart tomcat10

Verify if tomcat9 is working fine
sudo systemctl status tomcat10

Now press q for quitting from that window. Now open the browser to access Tomcat, enter
You should see a page that says.

That's it. You have setup Tomcat successfully!!

Watch steps in YouTube channel:
 

Thursday, August 19, 2021

Create Freestyle job in Jenkins | How to create Freestyle job in Jenkins to automate build and deployment to Tomcat

Jenkins is popular open source Continuous integration tool. It was written entirely in Java. Jenkins is a self-contained automation server used for automating builds, tests and deployment.

See below the steps for configuring Jenkins to automate the build and deployment for the project we already set up in GitHub. Let us see how to configure Jenkins to automate build and deployment:


pre-requisites:(please do this first before you start)

1. Make sure you configure maven installation under Jenkins-->manage Jenkins-> Global Tool Configuration. under maven installation. enter Maven3 as name, enter path of maven installation --> /usr/share/maven and uncheck install automatically option.

2. Also install SonarQube scanner,  deploy to container Jacoco plugins under Jenkins --> Manage Jenkins --> Manage plug-ins

Click on Available, type Sonarqube, select SonarQube scanner. Click on Install without restart.

SonarQube

Deploy to container


JaCoCo

Click on without restart.

3. Generate Personal Access Token(PSA) if you are using GitHub. Click here to learn how to generate that in GitHub and you can use your token as password.

steps to automate MyWebApp project in Jenkins:

1. Login to Jenkins. Click on New item.

2. Enter an item name --> select Free style project.
enter name as myFirstAutomateJob. click OK.
3. under source code mgmt, click git. enter your source code GitHub URL
Click on your repo, Copy the url from the browser. Paste the url as Repository URL below.


under credentials --> click Add- > select Jenkins -->  enter your GitHub userid and your PSA - Personal access token as password. You would have created PSA from pre-requisites (# 3) 
Add description as my SCM credentials.
Enter main as branch specifier or which ever branch you want to check out.

4. select that from drop down.
5. under build trigger click on poll scm, enter this value to check

for every 2 mins --> H/02 * * * *

6. Build --> Add build step --> invoke top level maven targets -->

select Maven3 from drop down and goal as clean install


7. Click on advanced, enter the path of POM file as --> MyWebApp/pom.xml


8. click on Add post build action, select Record Jacoco Code coverage report
  
9. click on Add post build action, select deploy war/ear to container.

      for WAR/EAR files enter as 
          **/*.war


in WAR/EAR files, leave context path empty

   10. click on Add container , select Tomcat 9.x

   11. click on add credentials, enter tomcat as user name and password as password.
      select it from drop down.
 


13. tomcat url should be --> http://your_public_dns_name:8080


click Apply, click Save
click on build now..It should build.
if there is any error, please check the console output. Most of the common error would be checking the path of Maven installation, valid credentials for GitHub or Tomcat. Also make sure you install the plug-ins.

After successful deployment, please make sure you check the output in Tomcat by going to browser and enter below URL

You should see Hello World!!!


This is how you automate the builds and deployments using Jenkins and migrate applications to AWS.

You can watch the video of this lab here:

  

Tuesday, September 22, 2020

How to change default port number in Tomcat? | Change default port number in Tomcat | Change default port number in Tomcat

 The default port number for Tomcat is 8080. It can be changed though by modifying the below properties file.

sudo vi /var/lib/tomcat9/conf/server.xml



 

 

 

Modify the desired port no in the above file. once you modify, you need to restart Tomcat service to take effect.

sudo service tomcat9 stop

sudo service tomcat9 start

sudo service tomcat9 status

Click here to see steps for how to install Tomcat9 on Ubuntu.

Sunday, April 12, 2020

Install Tomcat 9 on Ubuntu 22.0.4 | Setup Tomcat 9 on Ubuntu 22.0.4 in AWS EC2 | Setup Tomcat on Ubuntu

Tomcat is one of the popular web containers for deploying Java applications. Tomcat is open source. Click here to learn more about Tomcat. Let's see how to install Tomcat on Ubuntu 22.0.4.


Tomcat is both Web server and web container


Please follow below steps to install Tomcat 9 on Ubuntu 22.0.4.

Pre-requisites:
  • Create new EC2 instance first for setting up Tomcat. 
  • Also open port 8080 in security firewall rules for EC2 instance in AWS.
Tomcat Installation
Tomcat is a web server or web container where java web application can be deployed by developers. You can learn more about by clicking this URL.  Tomcat can be installed by executing below commands:

Change Host Name to Tomcat
sudo hostnamectl set-hostname Tomcat

Update to Latest packages
sudo apt update

Install Tomcat9
sudo apt install tomcat9 tomcat9-docs tomcat9-admin -y

Perform below command for setting up tomcat admin app
sudo cp -r /usr/share/tomcat9-admin/* /var/lib/tomcat9/webapps/ -v

Setup an user in tomcat 
Open the tomcat-users.xml file by executing below command
sudo vi /var/lib/tomcat9/conf/tomcat-users.xml

You need to edit the file, click on this link to know how to make changes using Vi editor.
We need to add tomcat user and assign to manager-script role.
Scroll down all the way to the end of the file,
Add the below lines in second last line above (above </tomcat-users>)

<role rolename="manager-script"/>
<user username="tomcat" password="password" roles="manager-script"/>


Now restart tomcat to take the changes in effect
sudo systemctl restart tomcat9

Verify if tomcat9 is working fine
sudo systemctl status tomcat9
Now press q for quitting from that window. Now open the browser to access Tomcat, enter
You should see a page that says.


That's it. You have setup Tomcat successfully!!
 
Watch Steps in YouTube Channel:

Saturday, February 16, 2019

How to implement CICD using Jenkins | Create Freestyle job in Jenkins | How to create build job in Jenkins to automate build and deployment of Java WAR file into Tomcat

Jenkins is popular open source Continuous integration tool. It was written entirely in Java. Jenkins is a self-contained automation server used for automating builds, tests and deployment.

See below the steps for configuring Jenkins to automate the build and deployment for the Java project we already set up in GitHub.


pre-requisites:
  • Also install deploy to container Jacoco plugins under Jenkins --> Manage Jenkins --> Manage plug-ins

Click on Available, type Deploy to container, select it. enter Jacoco, select it. Click on Install without restart.

Deploy to container


JaCoCo

Click on without restart.


steps to automate MyWebApp project in Jenkins:

1. Login to Jenkins. Click on New item.

2. Enter an item name --> select Free style project.
enter name as myFirstAutomateJob. click OK.
3. under source code mgmt, click git. enter Bitbucket URL or GitHub URL
Click on your repo, Copy the url from the browser. Paste the url as Repository URL below.


under credentials --> click Add- > select Jenkins -->  enter your GitHub username and Personal Access Token as password. DO NOT use Git Hub password as it is removed from August 13, 2021. Click to here to learn how to generate Personal Access Token. Add description as my SCM credentials.

Enter main as branch specifier or which ever branch you want to check out.

4. select that from drop down.
5. under build trigger click on poll scm, enter this value to check

for every 2 mins --> H/02 * * * *

6. Build --> Add build step --> invoke top level maven targets -->

select Maven3 from drop down and goal as clean install


7. Click on advanced, enter the path of POM file as --> MyWebApp/pom.xml


8. click on Add post build action, select Record Jacoco Code coverage report
  
9. click on Add post build action, select deploy war/ear to container.

      for WAR/EAR files enter as 
          **/*.war


in WAR/EAR files, leave context path empty

   10. click on Add container , select Tomcat 9.x

   11. click on add credentials, enter tomcat as user name and password as password.
      select it from drop down.
 


13. tomcat url should be --> http://your_public_dns_name:8080


click Apply, click Save
click on build now..It should build.
if there is any error, please check the console output. Most of the common error would be checking the path of Maven installation, valid credentials for GitHub or Tomcat. Also make sure you install the plug-ins.

After successful deployment, please make sure you check the output in Tomcat by going to browser and enter below URL

You should see Hello World!!!

This is how you automate the builds and deployments using Jenkins. Please watch the steps in YouTube channel:


🚀 Live AI-Enabled DevSecOps & Cloud Engineering Bootcamp – Sep 2026

Live AI-Enabled DevSecOps & Cloud Engineering Bootcamp from Coach AK - Sep 2026 Schedule