How To Install Jenkins Server On Ubuntu 20.04 / 19.10

We can install and download the latest version of Jenkins on ubuntu. You can also change the default port of Jenkins in ubuntu. Let’s see, how to install the Jenkins server. 

How To Install Jenkins Server On Ubuntu 20.04 / 19.10

We can easily install the Jenkins CI/CD tool on ubuntu 20.04 using the official repository. you can also download the latest version of Jenkins on ubuntu. 

Check Out: How To Install and Configure VSFTPD Server On CentOS 8 / 7

1. You need to add the GPG key and java version should be above 1.7+ using the following commands.

sudo wget -q -O - | sudo apt-key add -
sudo apt-get install openjdk-8-jdk

Check the java version on ubuntu and add the Jenkins repository source file using the below commands.

ubuntu@ubuntu:~$ java -version
openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0ubuntu2~20.04-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)
ubuntu@ubuntu:~$ sudo sh -c 'echo deb binary/ /etc/apt/sources.list.d/jenkins.list'

2. We need to update the system and install Jenkins using the following commands.

sudo apt update
sudo apt install jenkins

3. Once it’s installed, we have to start Jenkins and check the service status. 

ubuntu@ubuntu:~$ sudo systemctl start jenkins
ubuntu@ubuntu:~$ sudo systemctl enable jenkins
jenkins.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable jenkins
ubuntu@ubuntu:~$ sudo systemctl status jenkins
● jenkins.service - LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; generated)
Active: active (exited) since Sat 2020-08-08 13:25:35 PDT; 52s ago
Docs: man:systemd-sysv-generator(8)
Tasks: 0 (limit: 2285)
Memory: 0B
CGroup: /system.slice/jenkins.service

Check Out: Install Samba Server and Configure On Ubuntu 20.04/19.10

By default, Jenkins will use the port 8080 but I will change it to 9000 then start the installation on port 9000. we can change the default Jenkins port on ubuntu.

sudo vim /etc/default/jenkins

Restart the Jenkins server and verify the Jenkins should listen on port 9000.

ubuntu@ubuntu:~$ sudo systemctl restart jenkins
ubuntu@ubuntu:~$ sudo netstat -tnlp | grep 9000
tcp6   0   0    :::9000         :::*         LISTEN   9871/java

4. Open the port in the firewall rules on Ubuntu.

ubuntu@ubuntu:~$ sudo ufw allow 9000
Rules updated
Rules updated (v6)

Check the ufw status to confirm the new rules. 

ubuntu@ubuntu:~$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
Samba                      ALLOW        Anywhere                  
9000                       ALLOW        Anywhere                  
Samba (v6)                 ALLOW        Anywhere (v6)             
9000 (v6)                  ALLOW        Anywhere (v6)

5. Now access the Jenkins and install using the below URL. 


Get the Administrator password using the below command and paste it here then click on “Continue“. 

 cat /var/lib/jenkins/secrets/initialAdminPassword

Check Out: How To Update Jenkins Version Using rpm In Linux

Whether you can go with “Select plugins to install” or  “install suggested plugins“. I will be going with “Install suggested plugins“.

It will automatically start the installation of the required plugins on the Jenkins server. 

install jenkins server

Once the installation finished. we need to create a user to access the Jenkins server. Now click on “Save and Continue“. 

install jenkins on ubuntu

If you want to change the Jenkins URL, you can change it but I will go with the same UR and click on “Save and finish“.

install jenkins ubuntu

Check Out: How To Install Git In Jenkins Using Plugins On CentOS 7

Click on “Start using Jenkins“. 

download latest jenkins version

Jenkins has been installed and you can use it with URL

change jenkins port ubuntu

That’s it.

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment