TechTorch

Location:HOME > Technology > content

Technology

How to Install Jenkins CI: A Comprehensive Guide for Different Operating Systems

February 03, 2025Technology4317
How to Install Jenkins CI: A Comprehensive Guide for Different Operati

How to Install Jenkins CI: A Comprehensive Guide for Different Operating Systems

Jenkins is a widely-used open-source automation server for building and deploying software. Whether you are an individual developer or part of a large team, setting up Jenkins for continuous integration (CI) and continuous delivery (CD) can streamline your development process. This guide will walk you through the installation process for Jenkins on various operating systems.

Installing Jenkins CI on Ubuntu/Debian

Ubuntu and Debian are popular Linux distributions for both personal and enterprise use. Installing Jenkins on these systems is straightforward and involves several steps. Follow the instructions below to set up Jenkins:

First, update your package index to make sure you have the latest information about available packages:

sudo apt update

Jenkins requires Java to run. Install the OpenJDK package:

sudo apt install openjdk-11-jdk

Add the Jenkins repository to your system:

Import the GPG key to verify the authenticity of the repository contents:

wget -q -O - | sudo apt-key add -

Add the Jenkins repository to your sources list:

echo deb stable / | sudo tee -a 

Update the package index and install Jenkins:

sudo apt update
sudo apt install jenkins

Start the Jenkins service and enable it to start at boot:

sudo systemctl start jenkins
sudo systemctl enable jenkins

Access Jenkins by opening your web browser and navigating to http://localhost:8080. You will be prompted to enter an unlock key. The key is located in the following file:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Installing Jenkins CI on CentOS/RHEL

CentOS and RHEL are popular choices for both production and development environments. The installation process is similar to Ubuntu/Debian, with some slight variations. Follow the steps below to install Jenkins on CentOS/RHEL:

Install Java:

sudo yum install java-11-openjdk-devel

Add the Jenkins repository to your system:

sudo wget -O  
 -O 
sudo rpm --import 

Install Jenkins:

sudo yum install jenkins

Start the Jenkins service and enable it to start at boot:

sudo systemctl start jenkins
sudo systemctl enable jenkins

Access Jenkins in your web browser at http://localhost:8080. Enter the unlock key found in the following file:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Installing Jenkins CI on Windows

Windows users can install Jenkins by downloading and running the installer. Here are the steps to follow:

Go to the Jenkins download page and download the Windows installer.

Run the downloaded .msi file and follow the installation instructions.

If Java is not already installed, make sure to install it from the installer. The installer will prompt you to install Java if it is missing.

After installation, Jenkins runs as a service. Access it via http://localhost:8080 and enter the unlock key found in the installation log or in the specified location.

Additional Steps

Once Jenkins is installed, you can proceed with additional configurations to tailor it to your needs:

Configure Jenkins to set up the admin user and install recommended plugins.

If you have a firewall running, ensure that port 8080 is open. Use the following command:

sudo ufw allow 8080

By following these detailed steps, you should be able to successfully install Jenkins CI on your preferred operating system. If you have specific requirements or configurations, feel free to ask for further assistance.