Share on Social Media

In this configuration guide, you will learn, how to install Jenkins on CentOS 7 or other Redhat based Linux OS. #centlinux #linux #devops

What is Jenkins? :

Jenkins is a Java-based, open-source automation server. Jenkins is used to automate all sorts of tasks related to building, testing and delivering or deploying software. Jenkins is a fork of Project Hudson and it is maintained by the original Hudson developers since the Hudson had been acquired by Oracle. However, Jenkins has been evolved very much since its inception from Hudson.

What is CI/CD Pipeline? :

In DevOps, this automated process of building, testing and delivering is called CI/CD (Continuous Integration / Continuous Delivery) pipeline.

CI (Continuous integration) is a practice in which team members regularly commits their code changes to the version control repository (such as git or svn), after which automated builds and tests are performed using build tools (such as Apache Ant, Apache Maven, Gradle, Junit, etc).

CD (Continuous delivery) is a series of practices where code changes are automatically built, tested and deployed to production.

In this article, we will install Jenkins on CentOS 7 server. Although the same steps can be used to install Jenkins on Red Hat Enterprise Linux (RHEL) 7.

Read Also: How to install Jenkins on Rocky Linux 9

System Specification:

We have provisioned a CentOS 7 virtual machine with following specification:

  • Hostname –
  • IP Address –
  • Operating System – CentOS 7.6

Install OpenJDK on CentOS 7:

Since, Jenkins is a Java application therefore it requires JVM (Java Virtual Machine) to execute. Jenkins 2 is the current major version and it requires Java 8.

Connect to using ssh and install OpenJDK from CentOS 7 yum repository.

# yum install -y java-1.8.0-openjdk-devel

yum has installed OpenJDK and its dependent packages.

Java executables has been automatically added to PATH environment variable. Therefore, we are only required to set the JAVA_HOME environment variable.

# echo "export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-" >> /etc/profile
# . /etc/profile
# env | grep JAVA_HOME

Verify Java version.

# java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

OpenJDK has been installed and configured successfully.

Install Jenkins on CentOS 7:

Jenkins is available to install in various forms.

  • Individual RPM:
    Individual RPMs are available for every version of Jenkins, but one has to resolve dependencies manually.
  • Jenkins yum Repository:
    A Yum repository is provided for Jenkins packages. Here, dependent packages will be installed automatically.
  • Generic Web Archive:
    This Java web archive requires to be executed either using java command or should be deployed on a Jave EE Server (e.g Apache Tomcat) to work.

We will use Jenkins yum repository, because, it is quite simple to understand and in this method dependencies will resolved automatically.

Jenkins can be downloaded from Jenkins download page. Jenkins website also provides commands to install Jenkins yum repository on CentOS 7.

Install jenkins yum repository using the following commands.

# wget -O /etc/yum.repos.d/jenkins.repo
--2019-01-08 00:14:26--
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 85
Saving to: â/etc/yum.repos.d/jenkins.repoâ

100%[======================================>] 85          --.-K/s   in 0s

2019-01-08 00:14:27 (5.48 MB/s) - â/etc/yum.repos.d/jenkins.repoâ saved [85/85]

# rpm --import

Build yum cache for faster access to repositories.

# yum makecache
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * extras:
 * updates:
base                                                     | 3.6 kB     00:00
extras                                                   | 3.4 kB     00:00
jenkins                                                  | 2.9 kB     00:00
updates                                                  | 3.4 kB     00:00
Metadata Cache Created

Install Jenkins on CentOS 7 using yum command.

# yum install -y jenkins

Start and enable jenkins service.

# systemctl start jenkins
# systemctl enable jenkins
jenkins.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig jenkins on

Configure Linux Firewall:

Allow Service Port 8080/tcp in Linux Firewall.

# firewall-cmd --permanent --add-port=8080/tcp
# firewall-cmd --reload

Configure Jenkins Server:

Browse URL using a client browser.


Obtain the autogenerated password from the given file.

# cat /var/lib/jenkins/secrets/initialAdminPassword

Unlock Jenkins using this password.


Click on continue.


Click on Install Suggested Services.


Jenkins will install most commonly used plugins such as Apache Ant, Gradle, Git, etc.


Create an Admin user here.

Click on Save and Continue.


Jenkins provide a root URL here for accessing its various resources.

If you are happy with it then click on Save and Finish.


Jenkins has been successfully configured.

Click on Start using Jenkins.


Login using the admin user ahmer that we have created with Jenkins Setup Wizard.


Installation of Jenkins 2 on CentOS 7 has been completed.

You can refer to Jenkins User Documentation to understand the workflow and getting start with Jenkins.


In this configuration guide, you have learned, how to install Jenkins on CentOS 7 or other Redhat based Linux OS.

Leave a Reply

Your email address will not be published. Required fields are marked *