This post shows students and new users how to install Jenkins on Ubuntu Linux. Jenkins, an open source, self-contained Java-based automation server that can be used to easily set up continuous integration and continuous delivery (CI/CD) pipelines.
Jenkins is pretty versatile. It can be installed as a standalone app, a Java servlet container such as Apache Tomcat or run as a Docker container. 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:
How to install Java on Ubuntu Linux
Jenkins requires Java JDK to be installed in order to function. You can either install Oracle Java JDK or its open source alternative called OpenJDK.
Fore more detailed installation of Java, read our post here.
You can also run the commands below to install the default OpenJDK on Ubuntu.
sudo apt update sudo apt install default-jdk
Once the OpenJDK is installed, verify it by checking the Java version:
java -version
The command should output something similar to the lines below:
openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04) OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)
Java should be installed and ready to use
How to add Jenkins repository on Ubuntu
Installing Jenkins on Ubuntu Linux is relatively straightforward. Jenkins has its own repository for Linux systems.
Run the commands below to import the GPG keys of the Jenkins repository using the following wget command.
wget -q -O - | sudo apt-key add -
Then run the commands below to add the package repository.
sudo sh -c 'echo deb 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.
How to install Jenkins on Ubuntu Linux
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
How to set up Jenkins on Ubuntu
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 should do it!
Conclusion:
This post showed you how to install Jenkins on Ubuntu Linux. If you find any error above or have something to add, please use the comment form below.