DevOps Tool Series: JENKINS

Khemnath chauhan
4 min readAug 13, 2023

About Jenkins : -

  • Opensource CI/CD Software.
  • It helps to automate the various stages of CICD Process- from building and testing code to deploying applications.
  • It has lots of plugins available, we can write our own plugin, or can use the community plugin.
  • We can create slave nodes under Jenkins master, it instructs ither slave node to do job. if slave are not available Jenkins itself does the job.

Jenkins setup on ubuntu Server.

STEP 1: Create a Linux server either VM or Cloud. Im my case i have setup AWS cloud server and launch ubuntu EC2 instance.

STEP 2: Jenkins is java application , so we need to install java

# Install the openjdk
$ sudo apt install openjdk-11-jre

# Check the Java installation
$ java -version
openjdk version "11.0.20" 2023-07-18
OpenJDK Runtime Environment (build 11.0.20+8-post-Ubuntu-1ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.20+8-post-Ubuntu-1ubuntu122.04, mixed mode, sharing)

STEP 3: Install Jenkins software — There are multiple ways. Find the steps from below site.

$ curl -fsSL | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \ binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null

$ sudo apt-get update

$ sudo apt-get install jenkins
$ curl -fsSL | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \ binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null

$ sudo apt-get update
Hit:1 jammy InRelease
Get:2 jammy-updates InRelease [119 kB]
Get:3 jammy-backports InRelease [109 kB]
Ign:4 binary/ InRelease
Get:5 binary/ Release [2044 B]
Get:6 binary/ Release.gpg [833 B]
Hit:7 jammy-security InRelease
Get:8 jammy-updates/main amd64 Packages [866 kB]
Get:9 jammy-updates/universe amd64 Packages [965 kB]
Get:10 binary/ Packages [25.3 kB]
Fetched 2086 kB in 1s (1992 kB/s)
Reading package lists... Done

$ sudo apt-get install jenkins
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
The following NEW packages will be installed:
jenkins net-tools
0 upgraded, 2 newly installed, 0 to remove and 104 not upgraded.
Need to get 95.9 MB of archives.
After this operation, 99.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 jammy/main amd64 net-tools amd64 1.60+git20181103.0eebece-1ubuntu5 [204 kB]
Get:2 binary/ jenkins 2.401.3 [95.7 MB]
Fetched 95.9 MB in 3s (30.1 MB/s)
Selecting previously unselected package net-tools.
(Reading database ... 65900 files and directories currently installed.)
Preparing to unpack .../net-tools_1.60+git20181103.0eebece-1ubuntu5_amd64.deb ...
Unpacking net-tools (1.60+git20181103.0eebece-1ubuntu5) ...
Selecting previously unselected package jenkins.
Preparing to unpack .../jenkins_2.401.3_all.deb ...
Unpacking jenkins (2.401.3) ...
Setting up net-tools (1.60+git20181103.0eebece-1ubuntu5) ...
Setting up jenkins (2.401.3) ...
Created symlink /etc/systemd/system/ → /lib/systemd/system/jenkins.service.

Processing triggers for man-db (2.10.2-1) ...
Scanning processes...
Scanning linux images...

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

STEP 4: After successful installation, check the Jenkins is up and running

$ ps -ef |grep java
jenkins 4776 1 69 02:11 ? 00:00:44 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080
ubuntu 4992 1301 0 02:12 pts/0 00:00:00 grep --color=auto java

Now, you can access the jenkins page using the AWS public IP.

Note: Ensure the proper inbound rule are created for incoming access — http, https, SSH ..etc.

To get password:
cat /var/lib/jenkins/secrets/initialAdminPassword


Jenkins- Dashboard:


Let’s create a Jenkin Job:-

  • Go to — New Item on left panel.
  • Enter the Item name to create — Freestyle project.
  • Name as — “Testjob”