How To Install Jenkins In Linux?

Share on twitter
Tweet
Share on whatsapp
WhatsApp
Share on facebook
Share
how to install jenkins in linux

Continuous Integration tools are boon for developers, allowing them to integrate code into a shared repository and letting them know about problems in the builds. This allows developers to fix problems quickly by easily locating them. One great CI tool is Jenkins. If you’re a developer who uses Jenkins and has recently switched to Linux, here’s how to install Jenkins in Linux. First, let’s talk about why Jenkins is better than other CI software out there.

Why Use Jenkins?

Jenkins Admin Panel
Source: Wikipedia
  1. Jenkins is completely free, open-source, and is written in Java programming language, making it fairly portable.
  2. The community and support have gotten really good over time.
  3. Container technologies like Docker and Kubernetes can be used in Jenkins.
  4. Jenkins has one of the most comprehensive plugin integrations.

Before you go ahead and install Jenkins, make sure you have Java installed. Failing to do so will result in Jenkins throwing up errors.

How To Install Jenkins In Linux?

On Debian/Ubuntu-Based Distributions

  1. Download and add the key using the following command.
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -

2. Now, fire up the terminal and type the following command to edit the sources.list and add the following entry. Copy the command and press CTRL+X to exit. You will not be able to edit the file without superuser permissions.

sudo nano /etc/apt/sources.list
 deb https://pkg.jenkins.io/debian-stable binary/

3. Update the repo list and install Jenkins.

sudo apt-get update
 sudo apt-get install jenkins

On CentOS/Fedora/Red Hat

  1. Download and add the key using the commands.
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.key

2. Install Jenkins.

yum install jenkins

On OpenSUSE

  1. Add the repo using the following command.
sudo zypper addrepo -f https://pkg.jenkins.io/opensuse-stable/ jenkins

2. Install Jenkins.

zypper install jenkins

On Arch And Arch-Based Distributions

sudo pacman -S jenkins

How To Install Java In Ubuntu?

The easiest way to install Java is by installing Zulu builds of OpenJDK. All you need to do is download and open the .deb file, and Java will be installed.

  1. Head over to the official Zulu builds download page and download the most recent .deb file.
zulu openjdk builds - How to install Jenkins in Linux

2. After the download’s complete, open the file and wait for the installation process to complete. To check if Java was installed correctly, enter the following command.

java --version

3. To check if Jenkins is running or not, type this command and hit enter.

sudo systemctl status jenkins
jenkins status

Configuring Jenkins

  1. To configure Jenkins, you’ll need to find out your IP address. You can do that using the command.
ifconfig -a
Linux IP Address

2. Another way to find out your IP address is by going to Settings -> Wi-Fi -> Click on the gear icon beside the network name you’re connected to.

IP address Linux-2

3. Now, open your preferred browser and enter your IP address in the search bar followed by a colon and the port number :8080 and you will be asked to enter a password.

Unlock jenkins password - How to install Jenkins in Linux

4. To get the password, copy the following command and hit enter. Enter your Linux password if prompted.

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

Copy the 32-digit value that appears and paste it in the panel.

5. Now, install the plugins and voila! You have successfully installed Jenkins.

6. Create First Admin user by entering the credentials you want to use and click Save and Finish.

Are you a developer? Which CI tool do you use? Let us know in the comments section below.

Also, let us know if you encounter any issue during the installation.

Mohammed Abubakar

Mohammed Abubakar

Abubakar is a passionate tech writer whose love for tech started in 2011 when he got a Dell Inspiron 5100. When he's not covering Linux and open-source, you'll find him binge-watching anime or Tech content on YouTube.
Scroll to Top