How to Install Jenkins on CentOS 7

You can get access to a Linux machine by following below tutorial on google cloud set up and creating machine/instance from google cloud.

— Google Cloud set-up

— Create Instance / Machine in Google Cloud Platform (GCP)

Create CentOS 7 machine and follow below steps:

Bring system up-to-date by installing latest stable packages. Then reboot.

sudo yum install epel-release
sudo yum update
sudo reboot

Once reboot finishes, login with the same sudo users

Before installing Jenkins, you need to Install Java. To install OpenJDK Runtime Environment 1.8.0 we can use below command :

sudo yum install java-1.8.0-openjdk.x86_64

Confirm java installation by checking java version

java -version

Installing Jenkins :

cd ~
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
sudo rpm --import http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
sudo yum install Jenkins

Then you can start Jenkins service and set it to run at the boot time

sudo systemctl start jenkins.service this starts the Jenkins service

sudo systemctl enable jenkins.service this set it to run at the boot time.

To allow visitors to access using web browser, you need to allow inbound traffic on port 8080. For that run below two commands.

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

Now, you can test Jenkins by visiting the following address from your web browser:

http://<your-server-IP>:8080

First time you open above url, you will find below screen :

As mentioned in this page, you need to open file /var/lib/jenkins/secrets/initialAdminPassword and copy paste Administrator password.

Then you can install suggested plugins:

Once plugins are installed, create first admin userid password

That’s it, your Jenkins is installed and you are ready to create your new job at Jenkins.

Leave a Reply

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