×



Jenkins is a popular and open-source automation program based on Java. It helps developers to efficiently manage their tasks like building, testing, and deploying software. It automates software builds in a systematic way and notifies developers of errors as early as possible. It is a feature-rich program that can be extended through various plugins.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Software Installation tasks on your Linux system.

In this context, we shall look into how to install Jenkins on CentOS 8 machine.

For this installation procedure, you will need a user with root or sudo privileges.


Benefits of using Jenkins includes:

  • Jenkins is a free and open-source application.
  • Its ease of configuration is extended to encompass multiple environments.
  • It has an outstanding track record of stability and longevity.
  • Jenkins is platform-independent, so it works in almost every environment.
  • Jenkins supports cloud-native environments.
  • It offers a substantial number of tools and plugins, which increases its functionality.
  • Jenkins can use a dual mode of operation within two or more different environments.
  • It has a significant community base, which increases the availability of support options and documentation.

Steps to Install Jenkins on CentOS

Jenkins is not available in the CentOS default package repositories. We can install it by manually adding the Jenkins repository to our system repositories. So follow the below steps.


1. Install Prerequisites

To begin, we need to install prerequisites using the command below:

$ sudo yum install java-11-openjdk-devel

When prompted, Enter sudo password and if it asks for confirmation, press y and then Enter to confirm. After that, prerequisites will be installed.


2. Add Jenkins Repository

Now, Add the Jenkins repository to your system repositories using the below command:

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

This command will add Jenkins repository file jenkins.repo to the /etc/yum.repos.d directory.


3. Import Repository Key

Now it is time to import the Jenkins repository key so that the system can verify the package:

$ sudo rpm ––import https://pkg.jenkins.io/redhat/jenkins.io.key


4. Install Jenkins

Now in order to install Jenkins, use the command below:

$ sudo yum install jenkins

If it asks for confirmation, press y and then Enter to confirm. After that, Jenkins will be installed on your machine.


5. Start Jenkins Service

After Jenkins is installed, you will need to start and enable its service. To start Jenkins on your system, here is the command:

$ sudo systemctl start jenkins

To enable the service to start it automatically at boot, use the command below:

$ sudo systemctl enable jenkins

Then you can verify the status of service using the command below:

$ sudo systemctl status jenkins

If everything is working well, there will be active (running) status in the command output.


6. Adjust Firewall

Jenkins listens on port 8080. If your system is protected by a firewall and you want to access Jenkins from a remote machine, you will have to open port 8080 in your firewall.

First, to check if your system (where Jenkins is installed) is protected by a firewall, use the command below:

$ sudo systemctl status firewalld

If you see active (running) status in the output, it means the firewall is enabled on your system.

To open the port 8080 used by Jenkins in the firewall, use the command below:

$ sudo firewall-cmd ––permanent ––zone=public ––add-port=8080/tcp

Then reload firewall:

$ sudo firewall-cmd --reload


How to Launch Jenkins ?

To launch Jenkins, simply open your web browser and access http:/ip_address:8080 where ip_address is the IP address of the system where Jenkins is installed.

This will open the Unlock Jenkins page in your web browser which contains the location of the administrator password.

Here, you can retrieve the password. To do so, open the Terminal and type sudo cat followed by the location of the password mentioned in the Unlock Jenkins page. The command will output the Administrator password on the Terminal.

Next, Copy the password and type it under the Administrator password bar, then click Continue.

Then on the next page, click Install suggested plugins or click Select plugins to install if you want to select the plugins manually.

The Plugins will then be installed.

You will see the Getting Started window with the "Create First Admin User" page.

Next, on the Instance Configuration page, you will see the automatically generated URL of the Jenkins. Click Save and Finish.

Now the "Jenkins is ready!" page will appear showing how you to log in using the admin as username and password that you used to access the setup wizard. 

Finally, click Start using Jenkins.

You will be taken to Jenkins dashboard where you can start using it.


How to Uninstall Jenkins from CentOS machine ?

In case you want to remove Jenkins from your system, use the command below to do so:

$ sudo yum remove Jenkins

Once prompted, Provide sudo password. If prompted for confirmation, press y. After which, it will remove Jenkins from your system.


[Need assistance in Installing any Software on your Linux system ? We can help you. ]


Conclusion

This article covers how to install Jenkins on CentOS system. In fact, Jenkins is an open-source software written in Java and Scala which allows users the ability to automate almost any task and, it saves significant time that can be better utilized addressing other issues. When automating tasks with Jenkins, users can optimize their workflow by quickly automating the jobs that servers cannot do themselves.

Also, you will learn how to manage Jenkins services, allow them in firewall, and access Jenkins using the web browser.


More Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on IbmiMedia.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com