Saturday, December 31, 2022

How to install Java, Jenkins, Maven on Ubuntu EC2

  

How to install Java, Jenkins, Maven on Ubuntu EC2

 

Please follow steps to install Java, Jenkins, Maven, Tomcat on Ubuntu EC2. Jenkins is a java based application, so you need to install Java first. 

Java Setup on Ubuntu

sudo apt-get update

sudo apt update

Install Java Open JDK 8 package

sudo apt install default-jdk -y



Once install java, enter the below command


Verify Java Version

java -version

 

openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.16.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

Now lets do Jenkins installation

 

Installing Jenkins

Installing Jenkins on Ubuntu is relatively straightforward. We’ll enable the Jenkins APT repository, import the repository GPG key, and install the Jenkins package.

Import the GPG keys of the Jenkins repository using the following wget command:

curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
    /usr/share/keyrings/jenkins-keyring.asc > /dev/null

echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
    https://pkg.jenkins.io/debian binary/ | sudo tee \
    /etc/apt/sources.list.d/jenkins.list > /dev/null


Once the Jenkins repository is enabled, update the apt package list and install the latest version of Jenkins by typing:

sudo apt-get updatesudo apt-get install jenkins -y

systemctl status jenkins

You should see something like this:

● jenkins.service - LSB: Start Jenkins at boot time
     Loaded: loaded (/etc/init.d/jenkins; generated)
     Active: active (exited) since Thu 2020-07-16 20:22:12 UTC; 15min ago
...


Next Make Sure Port 8080 is Open

Go to your instance in AWS.... select Security Groups

Then click on the Security Group ID

Click on Edit Inbound Rules

Select Custom TCP Insert 8080 for Port range And set Source to 0.0.0.0/0

then Click Add rule

Access Jenkins in web browser

Now Go to AWS console.
  Click on EC2, click on running instances link. Select the checkbox of EC2 you are installing Java and Jenkins.

 

  Click on Action.

  Copy the value from step 4 that says --> Connect to your instance using its Public DNS


 

 

Now go to browser. enter public dns name or public IP address with port no 8080.This is how to select public DNS name:

 

http://EC2_public_dns_name:8080

 

Unlock Jenkins
You may get screen, enter the below command in Git bash( Ubuntu console)


Get the password from the below file

sudo cat /var/lib/jenkins/secrets/initialAdminPassword



Copy the password and paste in the browser

 

Click on install suggested plug-ins.


Also create user name and password.

enter everything as admin. at least user name as admin password as admin


Click on Save and Finish. Click on Start to Use.

 

Maven
sudo apt install maven -y


you can type mvn --version
you should see the below output.

No comments:

Post a Comment

Jenkins Scripted Pipeline - Create Jenkins Pipeline for Automating Builds, Code quality checks, Deployments to Tomcat - How to build, deploy WARs using Jenkins Pipeline - Build pipelines integrate with github, Sonarqube, Slack, JaCoCo, Nexus, Tomcat

  Jenkins Scripted Pipeline - Create Jenkins Pipeline for Automating Builds, Code quality checks, Deployments to Tomcat - How to build, depl...