How to Install Jenkins on Ubuntu 20.04

Hello all, Let’s learn how to install Jenkins on an Ubuntu VPS v20.04 easily without wasting your time. This is an easy and short article which only made for showing all the steps you need to follow. Before going to the installation process, you must already have a VPS with Ubuntu Installation with an unblocked 8080 port.

First, let’s update the OS and install java on VPS. Run the following command one by one to make it.

sudo apt update
sudo apt install openjdk-8-jdk

First, import the GPG keys of the Jenkins repository using the following wget command:

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -

Now, let’s add the Jenkins repository to the system like below:

sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

Once the Jenkins repository is enabled, update the apt package list and install the latest version of Jenkins by typing:

sudo apt update
sudo apt install jenkins

99% Done. Let’s start the Jenkins server and configure it for production use.

After we done with installation, we have to enable and start Jenkins service with the following commands:

systemctl enable jenkins && systemctl start jenkins

Jenkins by default is listening on port 8080. So, use the following commands to open the necessary port:

sudo ufw allow 8080

All done. I hope you got a good status report and now you just have to make type the IP with port {your-ip:8080} on the URL bar and find the password by using the following line.

Unlock Jenkins screen

Copy the password from your terminal, paste it into the Administrator password field and click Continue.

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Then you can follow the UI parts to make it completed.

Welcome to Jenkins Screen

That’s all. I hope all are well. Just leave a comment below if you got any issues