How to install Jenkins on Linux?
First published: Tuesday, January 23, 2024 | Last updated: Tuesday, January 23, 2024Know simple steps to install Jenkins on Linux-based operating systems to manage CI/CD pipeline workflows.
What is Jenkins?
Jenkins is an open source automation server written in Java. With Jenkins, organizations can accelerate the software development process by automating it. Jenkins manages and controls software delivery processes throughout the entire software development lifecycle, including build, document, test, package, stage, deployment, static code analysis and much more.
Install Jenkins
Before setting up a new Jenkins server, it is crucial to conduct a thorough check for any existing Jenkins installations. This article is dedicated to providing detailed guidance on installing Jenkins. It is highly recommended that a package manager be utilized to install Jenkins on Linux-based operating systems. Upon the completion of the installation, it is imperative to verify the Jenkins version to ensure that the installation was successful. For more in-depth information, please refer to the Jenkins documentation.
Linux (RPM)
You can use the following commands to install Jenkins in RPM-based Linux operating systems such as CentOS Linux, Red Hat Linux, Fedora Linux, Amazon Linux, Alma Linux, Rocky Linux, etc., or any other similar equivalents.
# Add Jenkins official GPG key to package manager.
$ sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
# Add Jenkins repository to package manager source list.
$ sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
# Install Open JDK.
$ sudo yum install java-21-openjdk
# Install Jenkins.
$ sudo yum install jenkins
# Start Jenkins service.
$ sudo systemctl start jenkins.service
# Check status of Jenkins service.
$ sudo systemctl status jenkins.service
# Enable Jenkins service at boot.
$ sudo systemctl enable jenkins.service
Linux (Debian)
You can use the following commands to install Jenkins in Debian-based Linux operating systems such as Ubuntu Linux, Mint Linux, Kali Linux, Kubuntu Linux, etc., or any other similar equivalents.
# Add Jenkins official GPG key to package manager.
$ sudo wget -O /etc/apt/keyrings/jenkins.asc https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
# Add Jenkins repository to package manager source list.
$ echo "deb [signed-by=/etc/apt/keyrings/jenkins.asc]" https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
# Update system packages info.
$ sudo apt update
# Install Open JDK.
$ sudo apt install openjdk-21-jre
# Install Jenkins.
$ sudo apt install jenkins
# Check status of Jenkins service.
$ sudo systemctl status jenkins.service
# Enable Jenkins service at boot.
$ sudo systemctl enable jenkins.service