December 17, 2020 By the melone Off

Jenkins in Linux Operating System

Installation of Java

Jenkins requires Java in order to run, yet certain distributions don’t include this by default and some Java versions are incompatible with Jenkins.

There are multiple Java implementations which you can use. OpenJDK is the most popular one at the moment, we will use it in this guide.

To install the Open Java Development Kit (OpenJDK) run the following:

  • Update the repositories
sudo apt update
  • search of all available packages:
sudo apt search openjdk
  • Pick one option and install it:
sudo apt install openjdk-8-jdk
  • Confirm installation:
sudo apt install openjdk-8-jdk
  • checking installation:
java -version
  • the result must be something like:
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1ubuntu1-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)



wget -q -O - | sudo apt-key add -
sudo sh -c 'echo deb binary/ > 
sudo apt-get update
sudo apt-get install jenkins

If an error is reported, “jenkins : Depends: daemon but it is not installable”, add the “universe” apt repository of community maintained free and open source software for Ubuntu by executing this command after sudo apt-get update:

sudo add-apt-repository universe

This package installation will:

  • Setup Jenkins as a daemon launched on start. See /etc/init.d/jenkins for more details.
  • Create a ‘jenkins’ user to run this service.
  • Direct console log output to the file /var/log/jenkins/jenkins.log. Check this file if you are troubleshooting Jenkins.
  • Populate /etc/default/jenkins with configuration parameters for the launch, e.g JENKINS_HOME
  • Set Jenkins to 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---- with ----HTTP_PORT=8081---- Here, “8081” was chosen but you can put another port available.