In this article, we will have explained the necessary steps to install and configure Jenkins on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
Jenkins is an open-source automation server. It is used for building software or apps automatically, unit testing of different programming projects, and much more. It ships with numerous and handy plugins which help in continuous integration by enabling developers to make the necessary changes to applications before going into production.
Install Jenkins on Ubuntu 20.04
Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.
sudo apt update sudo apt upgrade
Step 2. Install Java.
Jenkins is made in Java, so the first step is to install Java on the Ubuntu system:
sudo apt install openjdk-11-jre openjdk-11-jdk
Once installing Java you can verify it by running the following command:
Step 3. Install Jenkins on the Ubuntu system.
First, import the GPG keys of the Jenkins repository using the following
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
After this, we are going to add the Jenkins repositories to the
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
So to install the latest version of Jenkins, run the following command:
sudo apt update sudo apt install jenkins
After we have done with 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.
It is time to configure the permissions in the Firewall for remote and local access, Jenkins will use port 8080 for listening, we configure this port with the following command:
sudo ufw allow 8080
Step 4. Accessing Jenkins.
To start setting up our Jenkins, we need to visit its web dashboard running on port 8080. so open your browser and see your public IP address or your Domain name followed by the port number through it:
http://your_ip_address or your-domain:8080
When you first access a new Jenkins instance, you are asked to unlock it using an automatically generated password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
You should see a 32 character long alphanumeric password:
Copy the password from your terminal, paste it into the Administrator password field and click Continue:
Next, click on the Install suggested plugins box, and the installation process will start immediately:
Once the installation is complete, you will be prompted to set up the first administrative user.
That’s all you need to do to install Jenkins on Ubuntu 20.04 Focal Fossa. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.