Setup Jenkins on Ubuntu 16.04

What is Jenkins?
Jenkins is a self-contained, open source automation server which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software.
Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed.


Jenkins Installation
  • Prerequisite: Java should be pre-installed on the machine.
  • Add Jenkins key by running below command, you should get the output as OK. 
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
  • Add the Debian package repository to the sources.list. 
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
  • Run update to use the added repository. 
sudo apt-get update

  • Now install Jenkins using apt-get. 
sudo apt-get install jenkins

  • Once the installation is completed, start Jenkins using systemctl. 
systemctl start jenkins
  • Check the status to verify if Jenkins was successfully started. 
systemctl status jenkins



Optional Step: Opening the Port
  • Check if your firewall is enabled. You can skip this step and jump to next section "Setting up Jenkins" if your firewall is inactive.
sudo ufw status

  • If the firewall is enabled, you need to open your Jenkins port 8080.
sudo ufw allow 8080
  • You can now again do a status check and confirm port 8080 is open
sudo ufw status
 
  • Additional Step: You can allow OpenSSH as well using the command
sudo ufw allow OpenSSH

 


Setting up Jenkins
  • Open browser and browser http://localhost:8080, if you did the setup on a server, replace localhost with the server ip. 8080 is the default port for jenkins.

  • Fetch the password using cat from the mentioned path and enter it in the UI and click Continue.
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
  • In the next screen you will be given an option to customize Jenkins using plugin, go with the Install suggested plugins. You can install the additional plugins later from Manage Jenkins.



  • Plugins installation will take a while, post which you be prompted to create your first admin user. You can skip this by clicking Continue as admin but I recommend you create your own user and custom password.

  • On the next screen you will have an option to customize your Jenkins URL, you can choose to do so or leave it as http://localhost:8080

  • Click Save and Finish and your Jenkins is now ready to be used.

  • Click Start using Jenkins to visit the Jenkins Dashboard.



Follow this link to configure your Jenkins and create Jenkins node.

Comments

Popular posts from this blog

Get rid of "Timed out receiving message from renderer"

Setup Selenium Grid using Kubernetes

Launching Selenium Grid and Registering a Web Node