How To Install Jenkins Step by Step

Suresh yadav
Cypik
Published in
6 min readMar 14, 2024
  1. “Getting Started with Jenkins Installation”
  2. “Step-by-Step Guide to Installing Jenkins”
  3. “Installing and Configuring Jenkins for Continuous Integration”
  4. “Jenkins Installation Tutorial: Setting up Your CI/CD Pipeline”
  5. “Mastering Jenkins: Complete Installation Walkthrough”
  6. “Automating Your Build Process: Installing Jenkins”
  7. “Deploying Jenkins: Installation and Setup Guide”
  8. “Jenkins Essentials: Installing and Configuring Your CI Server”
  9. “Unlocking the Power of Jenkins: Installation and Basics”
  10. “Jenkins Installation Made Easy: A Beginner’s Guide”

The procedures in this chapter are for new installations of Jenkins.

Jenkins is typically run as a standalone application in its process. The Jenkins WAR file bundles Winstone, a Jetty servlet container wrapper, and can be started on any operating system or platform with a version of Java supported by Jenkins.

Installation of Java?

Jenkins requires Java to run, yet not all Linux distributions include Java by default. Additionally, not all Java versions are compatible with Jenkins.

There are multiple Java implementations that you can use. OpenJDK is the most popular one at the moment, we will use it in this guide.

Update the Debian apt repositories, install OpenJDK 17, and check the installation with the commands:

sudo apt update
sudo apt install fontconfig openjdk-17-jre
java -version

output:

openjdk version "17.0.8" 
OpenJDK Runtime Environment (build 17.0.8+7-Debian-1deb12u1)
OpenJDK 64-Bit Server VM (build 17.0.8+7-Debian-1deb12u1, mixed mode, sharing)

Debian/Ubuntu

On Debian and Debian-based distributions like Ubuntu, you can install Jenkins through apt.

Long-Term Support?

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
sudo apt-get update
sudo apt-get install jenkins

To install, add the repo key. For the latest key, visit the Jenkins Directory for all distributions. at {https://pkg.jenkins.io/debian-stable/}

Weekly release?

The team produces a new release weekly to provide bug fixes and new features to users and plugin developers who need them.

sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian/jenkins.io-2023.key
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins

To install, add the repo key. For the latest key, visit the Jenkins Directory for all distributions. at {https://pkg.jenkins.io/debian-stable/}

The package installation will:

  • Set up Jenkins as a daemon launched on start. Run systemctl cat jenkins for more details.
  • Create a ‘Jenkins’ user to run this service.
  • Direct console log output to systemd-journald. Run journalctl -u jenkins.service if you are troubleshooting Jenkins.
  • Populate /lib/systemd/system/jenkins.service 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 Jenkins fails to start because a port in 8080 is in use, run systemctl edit jenkins and add the following:

[Service]
Environment=”JENKINS_PORT=8081"

Here, “8081” was chosen but you can put another port available.

Fedora

You can install Jenkins through dnf. You need to add the Jenkins repository from the Jenkins website to the package manager first.

Long Term Support release

An LTS (Long-Term Support) release is chosen every 12 weeks from the stream of regular releases as the stable release for that period. It can be installed from the redhat-stable yum, repository.

sudo wget -O /etc/yum.repos.d/jenkins.repo \
https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
sudo dnf upgrade
# Add required dependencies for the jenkins package
sudo dnf install fontconfig java-17-openjdk
sudo dnf install jenkins
sudo systemctl daemon-reload

Weekly release

A new release is produced weekly to deliver bug fixes and features to users and plugin developers. It can be installed from the redhat yum, repository.

sudo wget -O /etc/yum.repos.d/jenkins.repo \
https://pkg.jenkins.io/redhat/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io-2023.key
sudo dnf upgrade
# Add required dependencies for the jenkins package
sudo dnf install fontconfig java-17-openjdk
sudo dnf install jenkins

Red Hat/CentOS

You can install Jenkins through yum Red Hat Enterprise Linux, Alma Linux, Rocky Linux, Oracle Linux, and other Red Hat-based distributions.

Long Term Support release

An LTS (Long-Term Support) release is chosen every 12 weeks from the stream of regular releases as the stable release for that time. It can be installed from the redhat-stable yum, repository.

sudo wget -O /etc/yum.repos.d/jenkins.repo \
https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
sudo yum upgrade
# Add required dependencies for the jenkins package
sudo yum install fontconfig java-17-openjdk
sudo yum install jenkins
sudo systemctl daemon-reload

To install, add the repo key. For the latest key, visit the Jenkins Directory for all distributions. at {https://pkg.jenkins.io/redhat-stable/}

Weekly release

A new release is produced weekly to deliver bug fixes and features to users and plugin developers. It can be installed from the redhat yum, repository.

sudo wget -O /etc/yum.repos.d/jenkins.repo \
https://pkg.jenkins.io/redhat/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io-2023.key
sudo yum upgrade
# Add required dependencies for the jenkins package
sudo yum install fontconfig java-17-openjdk
sudo yum install jenkins

To install, add the repo key. For the latest key, visit the Jenkins Directory for all distributions. at {https://pkg.jenkins.io/redhat-stable/}

Jenkins Start?

To enable the Jenkins service to start at boot, you can use the following command, depending on your operating system:

sudo service enable jenkins

You can start the Jenkins service with the command:

sudo service start jenkins

check the status of the Jenkins service:

sudo service status jenkins

you should see an output like this:

Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled)
Active: active (running) since thu 2024-03-14 16:43:01 +03; 2min 57s ago

Unlocking Jenkins?

http://localhost:8080

You can use the following commands to find and display the initial admin password:

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

Creating the first administrator user?

you can create your first administrator user.

  1. When the Create First Admin User page appears, specify the details for your administrator user in the respective fields and click Save and Finish.
  2. When the Jenkins is ready page appears, click Start using Jenkins.
    Notes:
    -
    This page may indicate Jenkins is almost ready! instead and if so, click Restart.
    - If the page does not automatically refresh after a minute, use your web browser to refresh the page manually.

3. If required, login to Jenkins with the credentials of the user you just created and you are ready to start using Jenkins!

Installation of Jenkins plugins has been started. It will take a couple of minutes to complete the installation.

Create the Admin account for Jenkins Portal.

On the ‘Instance Configuration’ page, it will ask you to set the default URL for Jenkins. Click on Save and Finish to proceed.

Jenkins installation has been completed successfully. Now, you can work on Jenkins by clicking on Start using Jenkins.

Jenkins’s dashboard is displayed below.

Access Jenkins

Now you can access Jenkins by simply providing an Admin username and password.

You can also check other alternatives using To Install Jenkins Docker Compose:

Enjoy it! 🍻 That’s It; we are done...

For seamless Cloud Management incorporating DevOps as the core of the methodology, reach out to us at info@cypik.com

Cypik

About the author:

My name is Suresh Yadav, and I am an experienced Linux enthusiast and DevOps engineer. I’m passionate about automating and streamlining development processes, and currently, I work as a DevOps Engineer at Cypik. I specialize in cloud technologies with a focus on Google Cloud Platform (GCP).

--

--

Suresh yadav
Cypik
Writer for

DevOps Engineer || GCP || Aws || Jenkins || Networking || Terraform || Github || Mysql || Ansible || Linux || Docker