> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Demo Jenkins Installation

> This guide explains how to install Jenkins LTS on an Ubuntu VM and complete the initial setup.

In this guide, you’ll learn how to install the **Jenkins LTS** release on an Ubuntu VM, verify prerequisites, install Java 17, and complete the initial setup via the web interface. By following these steps, you’ll have a stable, secure Jenkins server ready for your CI/CD pipelines.

## Table of Contents

1. [Choose a Jenkins Release](#choose-a-jenkins-release)
2. [System Prerequisites](#system-prerequisites)
3. [Add Jenkins APT Repository](#add-jenkins-apt-repository)
4. [Install Jenkins](#install-jenkins)
5. [Verify Jenkins Service](#verify-jenkins-service)
6. [Install Java 17](#install-java-17)
7. [Start Jenkins](#start-jenkins)
8. [Retrieve Initial Admin Password](#retrieve-initial-admin-password)
9. [Complete Setup Wizard](#complete-setup-wizard)
10. [References](#references)

## 1. Choose a Jenkins Release

Jenkins provides two main release lines:

| Release Type | Characteristics                                 | Recommended For                    |
| ------------ | ----------------------------------------------- | ---------------------------------- |
| **LTS**      | Stability, security fixes over extended support | Production environments            |
| **Weekly**   | Latest features and bug fixes                   | Testing and early feature adoption |

<Frame>
  ![The image shows a webpage from Jenkins.io detailing download and deployment options for Jenkins, including Stable (LTS) and Weekly releases, along with instructions for downloading Jenkins.](https://kodekloud.com/kk-media/image/upload/v1752870822/notes-assets/images/Certified-Jenkins-Engineer-Demo-Jenkins-Installation/jenkins-download-deployment-options.jpg)
</Frame>

Scroll to your platform on the [Jenkins download page][download]. You can select Docker, Kubernetes, Windows, or Debian/Ubuntu packages.

<Frame>
  ![The image shows the Jenkins download page, offering different package options for various platforms like Docker, Kubernetes, and Windows. It includes versions 2.462.1 LTS and 2.472, with links for each platform.](https://kodekloud.com/kk-media/image/upload/v1752870823/notes-assets/images/Certified-Jenkins-Engineer-Demo-Jenkins-Installation/jenkins-download-page-packages.jpg)
</Frame>

For public-cloud deployments, you also have AWS, Azure, Google Cloud, Oracle Cloud, and others:

<Frame>
  ![The image shows a webpage from Jenkins.io about deploying Jenkins in public cloud environments, featuring options for AWS, Azure, Google Cloud, Oracle Cloud, and Civo Kubernetes.](https://kodekloud.com/kk-media/image/upload/v1752870824/notes-assets/images/Certified-Jenkins-Engineer-Demo-Jenkins-Installation/jenkins-deploy-public-cloud-options.jpg)
</Frame>

In this tutorial, we’ll proceed with **Jenkins LTS** on **Ubuntu**.

## 2. System Prerequisites

Our test VM specifications:

| Resource | Specification |
| -------- | ------------- |
| RAM      | 4 GB          |
| CPU      | 2 cores       |
| OS       | Ubuntu 20.04+ |

Refer to the [Jenkins Linux prerequisites][prereq] for full details.

<Frame>
  ![The image shows a webpage from the Jenkins documentation, detailing prerequisites for installing Jenkins on Linux, including hardware and software requirements.](https://kodekloud.com/kk-media/image/upload/v1752870825/notes-assets/images/Certified-Jenkins-Engineer-Demo-Jenkins-Installation/jenkins-installation-prerequisites-linux.jpg)
</Frame>

## 3. Add Jenkins APT Repository

Add the Jenkins GPG key and repository:

```bash theme={null}
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
  https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key

echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
  https://pkg.jenkins.io/debian-stable binary/" \
  | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
```

Update APT and install Jenkins:

```bash theme={null}
sudo apt-get update
sudo apt-get install -y jenkins
```

## 4. Install Jenkins

During the installation, you should see output confirming the package download:

```plaintext theme={null}
Get:10 https://pkg.jenkins.io/debian-stable binary/ Packages [27.6 kB]
Hit:11 http://archive.ubuntu.com/ubuntu focal InRelease
Fetched 409 kB in 3s (147 kB/s)
Reading package lists... Done
The following NEW packages will be installed:
  jenkins net-tools
0 upgraded, 2 newly installed, 0 to remove and 8 not upgraded.
Get:1 https://pkg.jenkins.io/debian-stable binary/ jenkins 2.462.1 [91.2 MB]
```

## 5. Verify Jenkins Service

Immediately check Jenkins status:

```bash theme={null}
sudo systemctl status jenkins
```

If Java is missing, you’ll see a failure:

```plaintext theme={null}
● jenkins.service - Jenkins Continuous Integration Server
   Active: failed (Result: exit-code)
…
jenkins[31418]: jenkins: failed to find a valid Java installation
```

Inspect logs for details:

```bash theme={null}
sudo journalctl -u jenkins --no-pager
java -version
# Command 'java' not found
```

<Callout icon="triangle-alert" color="#FF6B6B">
  Jenkins requires a supported Java runtime to start. Installing or configuring Java is mandatory.
</Callout>

## 6. Install Java 17

Jenkins LTS supports **Java 17** per the [Java Support Policy][java-support].

<Frame>
  ![The image shows a webpage from Jenkins' documentation detailing the Java Support Policy, including supported Java versions and their corresponding long-term support and weekly release versions.](https://kodekloud.com/kk-media/image/upload/v1752870826/notes-assets/images/Certified-Jenkins-Engineer-Demo-Jenkins-Installation/jenkins-java-support-policy-docs.jpg)
</Frame>

Install OpenJDK 17 and fontconfig:

```bash theme={null}
sudo apt update
sudo apt install -y openjdk-17-jre fontconfig
java -version
```

Expected output:

```plaintext theme={null}
openjdk version "17.0.8" 2023-07-18
OpenJDK Runtime Environment (build 17.0.8+7-Debian-1deb12u1)
OpenJDK 64-Bit Server VM (build 17.0.8+7-Debian-1deb12u1, mixed mode)
```

## 7. Start Jenkins

Restart and check status:

```bash theme={null}
sudo systemctl restart jenkins
sudo systemctl status jenkins
```

You should see:

```plaintext theme={null}
● jenkins.service - Jenkins Continuous Integration Server
   Active: active (running) since Mon 2024-08-19 08:03:40 UTC; 10s ago
 Main PID: 34102 (java)
    CGroup: /system.slice/jenkins.service
           └─34102 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war ...
```

## 8. Retrieve Initial Admin Password

Find the initial admin password in the logs:

```bash theme={null}
sudo journalctl -u jenkins | grep 'initialAdminPassword'
```

Or directly read the file:

```bash theme={null}
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
```

Inspect the Jenkins home directory:

```bash theme={null}
ls /var/lib/jenkins
# config.xml  plugins  secrets  updates  users  jobs  ...
```

## 9. Complete Setup Wizard

1. Open `http://<YOUR_VM_IP>:8080` in your browser.
2. **Unlock Jenkins** with the admin password from `/var/lib/jenkins/secrets/initialAdminPassword`.
3. **Select Plugins**
   * Choose **Suggested Plugins** or pick specific ones.

<Frame>
  ![The image shows a Jenkins setup wizard interface with options for selecting plugins related to organization, administration, and build features. The user can choose from various plugins to install.](https://kodekloud.com/kk-media/image/upload/v1752870828/notes-assets/images/Certified-Jenkins-Engineer-Demo-Jenkins-Installation/jenkins-setup-wizard-plugins.jpg)
</Frame>

<Frame>
  ![The image shows a Jenkins setup wizard interface, specifically the "Pipelines and Continuous Delivery" section, where various plugins related to pipelines are listed for selection.](https://kodekloud.com/kk-media/image/upload/v1752870829/notes-assets/images/Certified-Jenkins-Engineer-Demo-Jenkins-Installation/jenkins-pipelines-setup-wizard.jpg)
</Frame>

<Frame>
  ![The image shows a Jenkins setup wizard interface with options for configuring plugins related to source code management, distributed builds, and user management and security. The interface includes checkboxes for selecting specific plugins to install.](https://kodekloud.com/kk-media/image/upload/v1752870830/notes-assets/images/Certified-Jenkins-Engineer-Demo-Jenkins-Installation/jenkins-setup-wizard-plugins-interface.jpg)
</Frame>

4. **Choose Appearance**\
   Pick your UI theme (e.g., Dark Theme):

<Frame>
  ![The image shows a Jenkins setup wizard interface with options for configuring notifications, appearance, and languages. The "Dark Theme" option is selected under the Appearance section.](https://kodekloud.com/kk-media/image/upload/v1752870834/notes-assets/images/Certified-Jenkins-Engineer-Demo-Jenkins-Installation/jenkins-setup-wizard-dark-theme.jpg)
</Frame>

5. **Create First Admin User**\
   Fill in credentials:

<Frame>
  ![The image shows a web page for creating the first admin user in a setup wizard, with fields for username, password, full name, and email address.](https://kodekloud.com/kk-media/image/upload/v1752870835/notes-assets/images/Certified-Jenkins-Engineer-Demo-Jenkins-Installation/admin-user-setup-wizard-page.jpg)
</Frame>

6. **Configure Jenkins URL**\
   Confirm or edit the root URL, then **Save and Finish**:

<Frame>
  ![The image shows a Jenkins setup wizard screen for instance configuration, prompting the user to enter a Jenkins URL. There are options to "Save and Finish" or "Not now."](https://kodekloud.com/kk-media/image/upload/v1752870837/notes-assets/images/Certified-Jenkins-Engineer-Demo-Jenkins-Installation/jenkins-setup-wizard-url-config.jpg)
</Frame>

Once done, Jenkins will be ready to use. Start creating your first build pipeline!

## 10. References

* [Jenkins Download & Setup][download]
* [Linux Prerequisites for Jenkins][prereq]
* [Jenkins Java Support Policy][java-support]
* [Jenkins Official Documentation][jenkins-docs]

[download]: https://www.jenkins.io/download/

[prereq]: https://www.jenkins.io/doc/book/installing/#prerequisites

[java-support]: https://www.jenkins.io/doc/book/system-administration/java/

[jenkins-docs]: https://www.jenkins.io/doc/

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/certified-jenkins-engineer/module/7ab00946-0edd-4a13-b5c8-1b5001779f1c/lesson/07cb1d74-2ff6-492e-8f56-1d08525cd038" />

  <Card title="Practice Lab" icon="installation" cta="Learn more" href="https://learn.kodekloud.com/user/courses/certified-jenkins-engineer/module/7ab00946-0edd-4a13-b5c8-1b5001779f1c/lesson/aeaa6095-8d5d-4470-9c89-33bfa2014677" />
</CardGroup>
