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 his 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 through the step by step installation Jenkins on a 20.04 LTS (Focal Fossa) server.
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 these 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:
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 with the installation, we have to enable and start 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 favourite browser and navigate to http://yourdomain.com:8080 or http://server-ip:8080 and complete the required steps to finish the installation.
Default installation password can be found at /var/lib/jenkins/secrets/initialAdminPassword as showing in 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.