How to Install and Configure Jenkins 2 on centos/Redhat Servers

Install and Configure Jenkins 2 on centos/Redhat Servers

In our previous post, we explained the latest jenkins features and installation for Debian-based servers. As per few user requests, we have created the steps for installing jenkins 2 versions on centos and Redhat servers.

Jenkins 2 on centos/Redhat

This tutorial will guide you to install Jenkins 2 on a centos/Redhat machines.

1. Install java 1.7 JDK.

sudo yum install -y java-1.7.0-openjdk-devel

2. Add the Jenkins repository.

sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo

3. Import the repo key.

sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key

4. There are many jenkins 2 versions. To install the specific version, you need to get the yum list. Use the following command to get the list of available jenkins versions.

yum --showduplicates list jenkins | expand

You will see a list like the following.

jenkins.noarch                         2.6-1.1                           jenkins
jenkins.noarch                         2.7-1.1                           jenkins
jenkins.noarch                         2.8-1.1                           jenkins
jenkins.noarch                         2.9-1.1                           jenkins

5. Select a specific version of your choice and install it using the following syntax.

sudo yum install (package name)-(version info)

For example, if you want to install 2.9-1.1, you can execute the command as shown below.

sudo yum install jenkins-2.9-1.1

6. Start the jenkins 2 service.

sudo service jenkins start

7. Enable jenkins as a startup service.

sudo chkconfig jenkins on

8. Allow the required ports using iptables.

sudo iptables -I INPUT 1 -p tcp --dport 8443 -j ACCEPT
sudo iptables -I INPUT 1 -p tcp --dport 8080 -j ACCEPT
sudo iptables -I INPUT 1 -p tcp --dport 443 -j ACCEPT
sudo iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT

9. Access the Jenkins dashboard on port 8080 using your servers IP address.

10. Open the following file in the terminal and copy the password. supply the password in the dashboard.

/var/lib/jenkins/secrets/initialAdminPassword

11. All the other steps are self-explanatory. You can follow the dashboard steps and configure plugins and users.

READ  Jenkins 2 Tutorial For Beginners - Getting Started Guide

Free DevOps Resources

Get DevOps news, tutorials and resources in your inbox. A perfect way If you want to get started with devops. Like you, we dont like spam.

3 comments

  1. Eduardo Simioni Reply

    For some reason this doesn’t work.
    When I list the versions it shows only from 1.409.1-1.1 to 1.651.3-1.1.
    Any clue on how to fix this?

Leave a Reply

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