In this section, we will cover the steps required to install Jenkins on various platforms. Jenkins can be installed on different operating systems, including Windows, macOS, and Linux. We will provide detailed instructions for each platform to ensure a smooth installation process.

Prerequisites

Before installing Jenkins, ensure you have the following prerequisites:

  • Java Development Kit (JDK): Jenkins requires Java to run. Ensure you have JDK 8 or later installed on your system.
  • Administrator Access: You need administrative privileges to install Jenkins.

Installing Jenkins on Windows

Step 1: Download Jenkins

  1. Visit the Jenkins download page.
  2. Under the "Windows" section, click on the "Windows" link to download the Jenkins Windows installer.

Step 2: Run the Installer

  1. Locate the downloaded .msi file and double-click it to run the installer.
  2. Follow the installation wizard steps:
    • Accept the license agreement.
    • Choose the installation directory (default is usually fine).
    • Select the components to install (default is recommended).

Step 3: Start Jenkins

  1. After installation, Jenkins will start automatically. If it doesn't, you can start it manually from the Start menu.
  2. Open a web browser and navigate to http://localhost:8080.
  3. You will be prompted to unlock Jenkins. Locate the initialAdminPassword file in the Jenkins installation directory (e.g., C:\Program Files (x86)\Jenkins\secrets\initialAdminPassword) and copy the password.
  4. Paste the password into the web interface to unlock Jenkins.

Step 4: Complete the Setup

  1. Follow the setup wizard to complete the installation:
    • Install suggested plugins.
    • Create the first admin user.
    • Configure the instance URL.

Installing Jenkins on macOS

Step 1: Install Homebrew

If you don't have Homebrew installed, you can install it by running the following command in your terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 2: Install Jenkins

  1. Open a terminal window.
  2. Run the following command to install Jenkins:
brew install jenkins-lts

Step 3: Start Jenkins

  1. Start Jenkins by running:
brew services start jenkins-lts
  1. Open a web browser and navigate to http://localhost:8080.
  2. Follow the same steps as in the Windows installation to unlock Jenkins and complete the setup.

Installing Jenkins on Linux

Step 1: Add Jenkins Repository

  1. Open a terminal window.
  2. Add the Jenkins repository key to your system:
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
  1. Add the Jenkins repository to your sources list:
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

Step 2: Install Jenkins

  1. Update your package list:
sudo apt-get update
  1. Install Jenkins:
sudo apt-get install jenkins

Step 3: Start Jenkins

  1. Start the Jenkins service:
sudo systemctl start jenkins
  1. Enable Jenkins to start on boot:
sudo systemctl enable jenkins
  1. Open a web browser and navigate to http://localhost:8080.
  2. Follow the same steps as in the Windows installation to unlock Jenkins and complete the setup.

Summary

In this section, we covered the installation of Jenkins on Windows, macOS, and Linux. We walked through the steps to download, install, and start Jenkins on each platform. Additionally, we discussed how to unlock Jenkins and complete the initial setup. With Jenkins installed, you are now ready to explore its features and start creating your first Jenkins job in the next section.

© Copyright 2024. All rights reserved