How to Install Jenkins on Ubuntu 20.04 | 18.04
This brief tutorial shows students and new users how to install Jenkins on Ubuntu 20.04 | 18.04.
Jenkins, an open source, self-contained Java-based automation server which was forked from the Hudson project can easily be installed on Ubuntu systems.
For those who don’t know about Jenkins, here’s a brief overview: It’s a leading open source automation server which provides hundreds of plugins to support building, deploying and automating any project.
Out-of-the-box, it supports Windows, Mac OS X and other Unix-like operating systems… and can easily be distributed across multiple machines, helping drive builds, tests and deployments for multiple platforms efficiently.
For more about Jenkins, connect to its homepage.
When you’re ready to install Jenkins, follow the steps below:When you’re ready to install Jenkins, follow the steps below:
Step 1: Install Java
Since Jenkins is a Java application, you’ll need Javed JDK installed… there’s an open source Java JDK program that’s great and easy to install.. to install OpenJDK, run the commands below…
sudo apt update sudo apt install openjdk-8-jdk
That should get OpenJDK installed on Ubuntu… Currently, Jenkins might not be fully compatible with Java JDK 9, 10 or 11… For now stay with Java 8 when using Jenkins…
Step 2: Add Jenkins Repository
Jenkins has its own repository for Linux systems… Run the commands below to add its repository key to Ubuntu..
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
Then run the commands below to add the package repository…
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
The commands above should enable Jenkins repository on Ubuntu.. All you have to do now is install Jenkins…
Step 3: Install Jenkins
Now that Jenkins’ repository has been added to Ubuntu, run the commands below to install Jenkins…
sudo apt update sudo apt install jenkins
After installing, Jenkins service will automatically start after the installation process is complete…. To verify if Jenkins is installed and running, run the commands below:
sudo systemctl status jenkins.service
You should see an output similar to the one below:
● jenkins.service - LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; generated)
Active: active (exited) since Tue 2018-10-16 10:40:32 CDT; 22s ago
Docs: man:systemd-sysv-generator(8)
Tasks: 0 (limit: 2321)
CGroup: /system.slice/jenkins.service
The commands below can also be used to start, stop and enable Jenkins service to automatically start when system boots…
sudo systemctl stop jenkins.service sudo systemctl start jenkins.service sudo systemctl enable jenkins.service
Step 4 Setting Up Jenkins
To set up your new Jenkins installation, open your browser, type the server hostname or IP address followed by port 8080, http://hostname:8080 and screen similar to the following will be displayed:

You will be prompted for an administrator password…
To get the password, run the commands below from Ubuntu terminal…
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
that should display the password to use… Copy and paste it into the box and continue…
On the next screen, you’ll be prompted whether to install suggested plugins or select plugins to install…. For simplicity sake, Click on the Install suggested plugins box, and the installation process will start immediately…

Wait for the suggested plugins to install… after that, create the first admin user account and click Save and Continue..

Jenkins instance URL should automatically be populated… accept the default or change to the server hostname or domain name and save… then finish..

That should complete Jenkins’ installation…

Click Start using Jenkins button and the setup should automatically sign you into the backend…

That’s it!
Conclusion:
This post showed you how to install Jenkins on Ubuntu 20.04 | 18.04. If you find any error above, please use the form below to report it.
Thanks,
You may also like the post below: