Linux serverNETWORK ADMINISTRATIONS

How to Install Jenkins on CentOS 7/8 Redhat Linux

In this I will show you how to install Jenkins in Linux centos 7 and centos 8 after installation we will create first freestyle Jenkins job.

Installing Jenkins on Centos 7 0r 8

Step 1 :
Install java
sudo yum install java-1.8.0-openjdk-devel
java version

Step 2 :
The next step is to enable the Jenkins repository:

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

And add the repository to your system with:

sudo rpm  – import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
Step 3 :
Once the repository is enabled, install the latest stable version of Jenkins by typing:

sudo yum install jenkins

Start the Jenkins service:

sudo systemctl start jenkins

To check whether it started successfully run:

systemctl status jenkins

Finally enable the Jenkins service to start on system boot:

sudo systemctl enable jenkins

Adjust the Firewall

If you are installing Jenkins on a remote CentOS server that is protected by a firewall you need to port 8080.

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

sudo firewall-cmd –reload

Setting Up Jenkins

Open your browser and type your domain or IP address followed by port 8080:

http://your_ip_or_domain:8080

Print the password on your terminal:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Copy the password from your terminal, paste it into the Administrator password field and click Continue.

Click on the Install suggested plugins box

Once the installation is complete, you will be prompted to set up the first administrative user. Fill out all required information and click Save and Continue.

On the next page, you will be asked to set the URL for the Jenkins instance. The URL field will be populated with an automatically generated URL.

To complete the setup confirm the URL by clicking on the Save and Finish button.

Finally, click on the Start using Jenkins button and you will be redirected to the Jenkins dashboard

You’ve successfully installed Jenkins on your CentOS system.

source

centos 8