Install Jenkins on Ubuntu 22.04

This article is going to show you how to install Jenkins on Ubuntu 22.04. Jenkins is a server for automating tasks that is free and open source. It aids continuous integration and delivery by automating the elements of software development related to building, testing, and deploying. It’s a server-side application that runs on servlet containers like Apache Tomcat. It can run Apache Ant, Apache Maven, and sbt-based projects, as well as arbitrary shell scripts and Windows batch instructions, and it supports version control tools such as AccuRev, CVS, Subversion, Git, Mercurial, Perforce, ClearCase, and RTC.

How to Install Jenkins on Ubuntu 22.04

  • To Install Jenkins on Ubuntu 22.04, start by adding Jenkins GPG key.
wget -q -O - | sudo apt-key add -
  • Next add Jenkins stable Debian package repository using the following command.
echo "deb binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list
  • Update changes by updating your system.
sudo apt update

Install Jenkins on Ubuntu 22.04

  • Run the following command to Install Jenkins on Ubuntu 22.04.
sudo apt install jenkins
  • Sample output
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  galera-4 libaio1 libconfig-inifiles-perl
  libdbd-mariadb-perl libfprint-2-tod1
  libhtml-template-perl libmariadb3 libpmem1
  libreadline5 libterm-readkey-perl
  mariadb-client-10.7 mariadb-client-core-10.7
  mariadb-common mariadb-server-10.7
  mariadb-server-core-10.7 mongodb-database-tools
  mongodb-mongosh socat
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
The following NEW packages will be installed:
  daemon jenkins
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 71.8 MB of archives.
After this operation, 72.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 focal/universe amd64 daemon amd64 0.6.4-1build2 [96.3 kB]
Get:2 binary/ jenkins 2.319.3 [71.7 MB]
Fetched 71.8 MB in 46s (1,567 kB/s)                  
Selecting previously unselected package daemon.
(Reading database ... 218985 files and directories cur
rently installed.)
Preparing to unpack .../daemon_0.6.4-1build2_amd64.deb
Unpacking daemon (0.6.4-1build2) ...
Selecting previously unselected package jenkins.
Preparing to unpack .../jenkins_2.319.3_all.deb ...
Unpacking jenkins (2.319.3) ...
Setting up daemon (0.6.4-1build2) ...
Setting up jenkins (2.319.3) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.15) ...
  • After installing Jenkins, it should be running. Confirm its status using the following command.
systemctl status jenkins

Sample output

● jenkins.service - LSB: Start Jenkins at boot time
     Loaded: loaded (/etc/init.d/jenkins; generated)
     Active: active (exited) since Mon 2022-02-28 13:>
       Docs: man:systemd-sysv-generator(8)
      Tasks: 0 (limit: 4588)
     Memory: 0B
     CGroup: /system.slice/jenkins.service

Feb 28 13:25:05 ubuntu systemd[1]: Starting LSB: Star>
Feb 28 13:25:05 ubuntu jenkins[29358]: Correct java v>
Feb 28 13:25:05 ubuntu jenkins[29358]:  * Starting Je>
Feb 28 13:25:06 ubuntu su[29438]: (to jenkins) root o>
Feb 28 13:25:06 ubuntu su[29438]: pam_unix(su-l:sessi>
Feb 28 13:25:08 ubuntu jenkins[29358]:    ...done.
Feb 28 13:25:08 ubuntu systemd[1]: Started LSB: Start>
  • If its not running, start Jenkins using the command below.
sudo systemctl start jenkins

Access Jenkins Web Interface on Ubuntu 22.04

  • By default, Jenkins listens on port 8080, If you have an active firewall open port 8080 using the command below.
sudo ufw allow 8080
  • Next fire up your favorite browser and type server IP followed by port 8080 e.g. server-IP:8080 or localhost:8080 if you are on localhost.
  • Find your password using the following command, it will print out your password.
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
  • After entering the password, select one option. I will go with Install suggested plugins.
  • After installing plugins it will take you to the next page where you can set up user details.
  • You have reached the end of the article, Congratulations. You have learned how to install Jenkins on Ubuntu 22.04.

Read more on Jenkins User Documentation.

Other Tutorials

Install Grafana on Ubuntu 22.04

Install Prometheus on Ubuntu 22.04

Install Ajenti Control Panel on Ubuntu 22.04

System administrator | Software Developer | DevOps

Leave a Comment