How to install jenkins on CentOS 8 / RHEL 8

0
197

Jenkins is a free and open-source automation server written in Java. It is Released under the MIT License. Jenkins helps to automate the non-human part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery. So, In this article you will learn that how to install Jenkins on CentOS 8 and RHEL 8

Jenkins It is a server-based system that runs in servlet containers such as Apache Tomcat. Jenkins supports version control tools, including AccuRev, CVS, Subversion, Git, Mercurial, Perforce, TD/OMS, ClearCase, and RTC, and can execute Apache Ant, Apache Maven, and sbt based projects as well as arbitrary shell scripts and Windows batch commands.

This provides hundreds of plugins to support building, deploying and automating any project under MIT license.

Just login as root user and follow below steps.

Step 1- Upgrade System

The very first step should update your system so everything will upto date and you will get secure.

dnf update -y

Step 2- Install JAVA

As I mentioned earlier Jenkins is build in JAVA, so we have to install JAVA on the server so we can use jenkins properly.

dnf install -y  java-1.8.0-openjdk
Installing JAVA

Now verify java version

java -version

Step 3: Adding Jenkins Repository

Now, we will add Jenkins Repository in Centos 7 / RHEL 8 so we can install it as Jenkins did not come with CentOS default repository.

First, install wget package is no installed already

dnf install -y wget

Then, download and enable Jenkins Repository

wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo

Now, import Jenkins GPG Key

rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

Step 4- Install Jenkins on your CentOS 8 / RHEL 8 system

dnf install -y jenkins

Step 5- Start and Enable Jenkins Service

Now you have to start jenkins service so we can use it and enable it on boot so if system will reboot jenkins will start automatically

systemctl start jenkins
systemctl enable jenkins
systemctl status jenkins 

Step 6- Configure Firewall

You know Jenkins is works on port 8080 so we need to allow connection on that port by adding it in firewall.

firewall-cmd --zone=public --permanent  --add-port=8080/tcp
firewall-cmd --reload

Step 7- Setting Up Jenkins

Finally, everything is working fine as jenkins is installed successfully, now we you need to open your web browser and access jenkins using below URL:

YOUR-SERVER-IP:8080

You will see below page asking for Admin password to Unlock jenkins, when you browse the URL first time.

A path is also display on the page in which the password is saved, so go to your Linux terminal and issue following command to get the password.

cat /var/lib/jenkins/secrets/initialAdminPassword

Now, copy the password and paste it into the “Administrator password” box and click Continue.

So you will be asked if you want to install the suggested plugins or install additional plugins. I choose “install the suggested plugins” option you can choose your desired and the installation process will start immediately.

Note: If you are facing any issue during plugins installation, Click on “Select plugins to install” option then un-select all plugins. You can install desired plugins from jenkins dashboard also.

Now, create an admin account which will be used to manage the Jenkins server.

Then, you need to set Jenkins URL, set a URL or leave it as default and click on Save and Finish button.

Finally, everything has been done, click on “Start using Jenkins” button

and you will redirect to the Jenkins dashboard.

That’s it.

Jenkins allows you to deploy and automate important tasks for application development in an enterprise environment. However, it requires some previous knowledge of Linux.

LEAVE A REPLY

Please enter your comment!
Please enter your name here