Installing Jenkins

This is still very much a work in progress

This section is part of Getting Started. It provides instructions for basic Jenkins configuration on a number of platforms. It DOES NOT cover the full range of considerations or options for installing Jenkins. See Advanced Jenkins Installation

Overview

Pre-install

System Requirements

These are starting points. For a full discussion of factors see Discussion of hardware recommendations.

Minimum Recommended Configuration:

  • Java 7

  • 256MB free memory

  • 1GB+ free disk space

Recommended Configuration for Small Team:

  • Java 8

  • 1GB+ free memory

  • 50GB+ free disk space

Experimentation, Staging, or Production?

How you configure Jenkins will differ significantly depending on your intended use cases. This section is specifically targeted to initial use and experimentation. For other scenarios, see Advanced Jenkins Installation.

Stand-alone or Servlet?

Jenkins can run stand-alone in it’s own process using it’s own web server. It can also run as one servlet in an existing framework, such as Tomcat. This section is specifically targeted to stand-alone install and execution. For other scenarios, see Advanced Jenkins Installation

Installation

These are clean install instructions for non-production environments. If you have a non-production Jenkins server already running on a system and want to upgrade, see Upgrading Jenkins. If you are installing or upgrading a production Jenkins server, see Advanced Jenkins Installation.

Unix/Linux

Debian/Ubuntu

On Debian-based distributions, such as Ubuntu, you can install Jenkins through apt.

Recent versions are available in an apt repository. Older but stable LTS versions are in this apt repository.

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.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

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.

OS X

To install from the website, using a package:

Jenkins can also be installed using brew:

  • Install the latest release version

brew install jenkins
  • Install the LTS version

brew install jenkins-lts

Windows

To install from the website, using the installer:

Docker

You must have Docker properly installed on your machine. See the Docker installation guide for details.

First, pull the official jenkins image from Docker repository.

docker pull jenkins

Next, run a container using this image and map data directory from the container to the host; e.g in the example below /var/jenkins_home from the container is mapped to jenkins/ directory from the current path on the host. Jenkins 8080 port is also exposed to the host as 49001.

docker run -d -p 49001:8080 -v $PWD/jenkins:/var/jenkins_home -t jenkins

Post-install (Setup Wizard)

Create Admin User and Password for Jenkins

Jenkins is initially configured to be secure on first launch. Jenkins can no longer be accessed without a username and password and open ports are limited. During the initial run of Jenkins a security token is generated and printed in the console log:

*************************************************************

Jenkins initial setup is required. A security token is required to proceed.
Please use the following security token to proceed to installation:

41d2b60b0e4cb5bf2025d33b21cb

*************************************************************

The install instructions for each of the platforms above includes the default location for when you can find this log output. This token must be entered in the "Setup Wizard" the first time you open the Jenkins UI. This token will also serve as the default password for the user admin if you skip the user-creation step in the Setup Wizard.

Initial Plugin Installation

The Setup Wizard will also install the initial plugins for this Jenkins server. The recommended set of plugins available are based on the most common use cases. You are free to add more during the Setup Wizard or install them later as needed.