How to Install Jenkins in Redhat Linux

Jenkins is a popular open source continuous integration tool that allows you to build & deploy code automatically for software development. It enables you to automate many tasks related to software development and helps you continuously develop software. Here are the steps to install Jenkins in Redhat Linux. You can also use them to install Jenkins in CentOS.

How to Install Jenkins in Redhat Linux

Here are the steps to install Jenkins in Redhat Linux. Please note, you need to log in as root user or a user with root privileges to install Jenkins.

1. Add Jenkins Repository

Open terminal and run the following commands to add Jenkins repository to source list.

# wget -O /etc/yum.repos.d/jenkins.repo
# rpm --import

Also read : How to Add Conditional Headers in NGINX

2. Install Jenkins and Java

Run the following command to install Jenkins and Java.

# yum install jenkins java-1.8.0-openjdk –y

Also read : How to Install Apache Cassandra in Ubuntu

3. Start & Enable Jenkins

Run the following commands to enable Jenkins to start at boot, as well as start it now.

# systemctl start jenkins 
# systemctl enable jenkins

Also read : How to Create Empty File in Linux

4. Open Ports 80 and 8080 in Linux Firewall

Jenkins service uses ports 80 and 8080. We need to open them in our firewall using following commands.

# firewall-cmd --zone=public --add-port=8080/tcp --permanent success 
# firewall-cmd --zone=public --add-service=http --permanent success 
# firewall-cmd --reload

Also read : How to Install Sublime Text in Ubuntu

5. Test Jenkins Installation

Open browser and go to http://<Ip-Address-of-your-Server>:8080

You will see a page where you will be asked to enter administrator password. It is present in /var/log/jenkins/jenkins.log file. Run the following command in your terminal to get admin password for Jenkins.

# grep -A 5 password /var/log/jenkins/jenkins.log

Copy paste the displayed password and click Continue.

Also read : How to Add & Remove User in Ubuntu

6. Configure Jenkins

On the next screen, click Install Suggested Plugins. Jenkins will automatically install the recommended plugins.

Next, it will ask you to create admin user. You will be required to enter username, password, full name & email id for this user. Enter those values and click Save and Finish.

You will see the setup completion screen. Click Start Using Jenkins.

jenkins setup complete screen

You will see the Jenkins Dashboard where you can continue to integrate different software development tools as per your requirement.

That’s it. In this article, you have seen how to install & configure Jenkins in Redhat Linux.

Also read : How to Read & Write Files in Python