Installing Jenkins on Ubuntu

Installation wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

Upgrade
Once installed like this, you can update to the later version of Jenkins (when it comes out) by running the following commands: sudo apt-get update
sudo apt-get install jenkins

What does this package do?

  • Jenkins will be launched as a daemon up on start. See /etc/init.d/jenkins for more details.
  • The 'jenkins' user is created to run this service.
  • Log file will be placed in /var/log/jenkins/jenkins.log. Check this file if you are troubleshooting Jenkins.
  • /etc/default/jenkins will capture configuration parameters for the launch like e.g JENKINS_HOME
  • By default, Jenkins listen on port 8080. Access this port with your browser to start configuration.

If your /etc/init.d/jenkins file fails to start jenkins, edit the /etc/default/jenkins to replace the line HTTP_PORT=8080 by HTTP_PORT=8081 Here, 8081 was chosen but you can put another port available.

If you faced the problem download failed
Oracle JDK is NOT installed.
dpkg: error processing package oracle-java8-installer (--configure):
subprocess installed post-installation script returned error exit status 1
read the article How to install java 8 on Ubuntu 16.04

You can read the original article here.