How to Install Jenkins on Ubuntu 18.04/20.04 | RS Digitech

How to Install Jenkins server on Ubuntu 18.04/20.04

Jenkins is mainly used for Continues Integration (CI) and Continuous Deployment (CD). It is a java-based tool that can be installed from ubuntu. It is an open-source automation server. By using Jenkins, you can automate tasks like build the code whenever a developer pushes the changes into the repository. 

What are the required things?

  • Choose a VM Instance with at least 1 GB of RAM 
  • Install java 8

Stages for the Installation process:

  1. We need to update our Ubuntu with the following command.

sudo apt-get update

  1. Install openjdk8 on ubuntu.

sudo apt install openjdk-8-jdk

  1. Verify the Java version.

java -version

The output should be shown below. 

open JDK output

       Now, java is working fine.

  1. Add the Debian repository key to the system.

sudo wget -q -o -https://pkg.jenkins.io/Debian/Jenkins.io.key | sudo apt-key add -

  1. Add the Repository address to the sources list.

sudo sh -c ‘echo deb http://pkg.jenkins.io/debian-stable-binary/> /etc/apt/sources.list.f/Jenkins.list’

  1. Now we can update && Install Jenkins on ubuntu.

sudo apt-get update

sudo apt-get install jenkins

      Check the status Jenkins by using the below command

sudo systemctl status jenkins.


The output of Jenkins is shown like this.   

The output of Jenkins is shown

  1. Next, you need to allow the 8080 port number for Jenkins. 

sudo ufw allow 8080

Now check the rules of the ufw firewall by using…

Now check the rules of the ufw firewall

       If the firewall is inactive, use the following commands to enable it.

      # sudo ufw allow OpenSSH

      # sudo ufw enable

Restart the Jenkins

# systemctl restart jenkins

  1. Visit Jenkins on a browser with default port 8080: http://server_ip_address:8080

unlock jenkins

 

Get the initial admin password by using the below command:

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

Enter the password and continue:

Then you can choose Install suggested plugins or select plugins to install any one of them.

image

Once click on "Install suggested plugins" to start your installation.

 

Getting Started

 

When the installation is done with some of the suggested plugins the next screen should be like this.

 

Create Admin User

 

Now, you can create an Admin User and password or choose to skip and continue as admin.

The next page should be asking Instance Configuration Jenkins URL. You can confirm with the server IP address with the default port number.

 

Instanse Configuration

Click on Save and Finish.

Now choose to start using Jenkins.

Jenkins ready

 

Finally, your Jenkins dashboard will be like this as shown in the image

dashboard