In this tutorial, we will show you how to install Jenkins on Ubuntu 20.04 LTS. For those of you who didn’t know, Jenkins is an open-source automation server that is used to automate software development. Jenkins will automate the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery. By using Jenkins the developers will know the status of their application. Failures, new features, and processes will be automated and monitored.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of Jenkins on a 20.04 LTS (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
Prerequisites
- A server running one of the following operating systems: Ubuntu 20.04, 18.04, and any other Debian-based distribution like Linux Mint or elementary OS.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Jenkins on Ubuntu 20.04 LTS Focal Fossa
Step 1. First, make sure that all your system packages are up-to-date by running the following apt
commands in the terminal.
sudo apt update sudo apt upgrade
Step 2. Installing Java.
Jenkins is made in Java, So to install Java just run the following command:
sudo apt install openjdk-11-jdk
Verify the Java version by running the following command:
java -version
Step 3. Installing Jenkins on Ubuntu 20.04.
Now you have to add the Jenkins repository. But first, add the GPG key to secure the repository:
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
Next, add the Jenkins repository to the system:
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
After that the Jenkins repository is enabled, update the apt package list and install the latest version of Jenkins:
sudo apt update sudo apt install jenkins
Once we have done the installation, we have to enable and start the Jenkins service with the following commands:
sudo systemctl enable jenkins sudo systemctl start jenkins
Step 4. Configure Firewall.
Enabled Jenkins server allows the 8080 port for incoming traffic:
sudo ufw allow 8080
Step 5. Accessing Jenkins.
Jenkins will be available on HTTP port 8080 by default. Open your favorite browser and navigate to http://your-domain.com:8080
or http://server-ip:8080
and complete the required steps to finish the installation.
The default installation password can be found at /var/lib/jenkins/secrets/initialAdminPassword
as shown in the below image.
Congratulations! You have successfully installed Jenkins. Thanks for using this tutorial for installing Jenkins on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you to check the official Jenkins website.