Install Jenkins on ubuntu 18.04

Jenkins is an open-source devops tools for server/cloud that Mainly automates the tasks involved in Continuous Integration as well as Continuous delivery by integrating several plugins and other devops tools like terraform, ansible, sonar, bitbucket, maven, docker, k8 etc.

Step 1 — Install JRE / JDK

We need JRE/JDK in order to compile and run some specific Java-based software.

sudo apt install default-jdk

Step 2 — Installing Jenkins

Add the repository key

wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -

Append the Debian package repository address to the server  sources.list

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

Now run apt update so that apt will use the new repository from  sources.list and install Jenkins

sudo apt update
sudo apt install jenkins

Step 3 — Starting Jenkins

sudo systemctl start jenkins
sudo systemctl status jenkin
// enable service to start at OS startup
sudo systemctl enable jenkins

Step 4 — Opening the Firewall

sudo ufw allow 8080
sudo ufw status

Step 5 — Setting Up Jenkins

Check this URL : http://your_server_ip_or_domain:8080

To get the password run this command :
sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Then next screen presents the option of installing plugins

Click the Install suggested plugins option, which will immediately begin the installation process:
When the installation is complete, you will be prompted to set up the first administrative user. It’s possible to skip this step and continue as admin using the initial password we used above
Fill the form according to your inputs
Click Save and Finish. You will see a confirmation page confirming that “Jenkins is Ready!”

You have completed a successful installation of Jenkins