You can Watch all our Tutorials and Training Videos for Free on ourYouTube Channel

How to Install Jenkins on CentOS 8?

install jenkins on centos 8, jenkins installation on centos, jenkins install centos, configure jenkins, jenkins command line, centos install jenkins
How to Install Jenkins on CentOS 8

This article will provide you the step-by-step guide on how to install Jenkins on CentOS 8:

In the previous post, We have covered below topics on Jenkins.

If you are interested in learning, Request you to go through the below recommended tutorial.

DevOps Full Course Tutorial for Beginners - DevOps Free Training Online
Docker Full Course Tutorial for Beginners - Docker Free Training Online
Kubernetes Full Course Tutorial for Beginners - Kubernetes Free Training Online
Ansible Full Course Tutorial for Beginners - Ansible Free Training Online
Openstack Full Course Tutorial for Beginners - Openstack Free Training Online

Let's Get Started.


1. Centos 8 or CentOS 8 Steam Installed Server
2. Internet must be enabled to fetch and install required packages.
3. Admin privileges (root or sudo access)

Steps to Install Jenkins on CentOS 8

Step 1: Update the System

Before installing Jenkins, it's essential to ensure your CentOS system is up to date. Open your terminal and run the following commands:
sudo yum update

Step 2: Install Java

Jenkins requires Java to run. You can install OpenJDK, which is open-source and compatible with Jenkins:
sudo yum -y install java-11-openjdk-devel
After the installation is complete, verify the Java version:
java -version

Step 3: Add Jenkins Repository

To install the latest version of Jenkins, add the Jenkins repository:
sudo wget -O /etc/yum.repos.d/jenkins.repo
sudo rpm --import

Step 4: Install Jenkins

Now, you can install Jenkins using the following command:
sudo yum -y install jenkins

Step 5: Start and Enable Jenkins

Once Jenkins is installed, start the service and enable it to start on boot:
sudo systemctl start jenkins
sudo systemctl enable jenkins

Step 6: Check Jenkins Status

To verify that Jenkins is running, use the following command:
sudo systemctl status jenkins
You should see a message indicating that Jenkins is active and running.

Step 7. Allow Port 8080 on Firewall:

If you have firewalld enabled on your server, then we must allow our Jenkins default port 8080 to make it accessible from network, if not we can ignore this step.

To allow incoming traffic on port 8080, run:
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload

Step 8: Unlock Jenkins

Jenkins is initially locked, and you need to retrieve the initial admin password to unlock it. Run this command to get the password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
This command will display the password you need to unlock Jenkins. Copy it.

Step 9: Access Jenkins Web Interface

Open a web browser and enter your server's IP address followed by port 8080, like this: http://your_server_ip:8080.

You will be prompted to enter the initial admin password obtained in Step 7. Paste the password and click "Continue."

Step 10: Install Recommended Plugins

Select the "Install suggested plugins" option. Jenkins will begin downloading and installing the required plugins.

Step 11: Create an Admin User

After the plugins are installed, you'll be prompted to create an admin user. Fill in the required details.

Step 12: Start Using Jenkins

Once you've completed the setup, Jenkins is ready to use. You can start creating and managing your Jenkins jobs to automate your development workflows.

By following these steps, you've successfully installed Jenkins on your CentOS 8 server, and you're now ready to harness its automation capabilities for your projects.

Additional Configurations on Jenkins:

Any Users created in jenkins console are only to manage jenkins through web browser. Bydefault, user 'jenkins' only runs everything in background even if you have loggedin using any users on portal and this user "jenkins" is created during the installation at the Operating system level, but it is a non-root user.
cat /etc/passwd | grep -i jenkins
So When user "jenkins" doesnt have sufficient previleges at the Operating system level, this user cannot perform all administrative level tasks. So we must configure sudo to gain the administrative level access.

SUDO Access:

Edit /etc/sudoers file and add below entry to allow user "jenkins" to use sudo with nopasswd prompt and also disable requiretty option.
Defaults !requiretty

Change Jenkins user shell:

Verify the "jenkins" user shell. If it is already specified with "/bin/bash", You can ignore this. If not, we must change the user shell, this would help us to perform any tasks using CLI.
cat /etc/passwd | grep -i jenkins
jenkins:x:995:992:Jenkins Automation Server:/var/lib/jenkins:/bin/bash

Restart Service:

sudo systemctl restart jenkins

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.
whatsapp logo