Install and configure Jenkins on CentOS

Install and configure Jenkins on CentOS
Written by Abhishek JalanApril 18, 2020
1 min read
Jenkins
6 VIEWS 1 LIKES 0 DISLIKES SHARE
1 LIKES 0 DISLIKES 6 VIEWS SHARE
Abhishek Jalan

DevSecOps Engineer

Let's install Jenkins on CentOS

Jenkins Installation and setup

SSH to CENTOS Machine with root credentials.

Please follow the below steps:

yum install -y wget vim  
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum install jenkins java-1.8.0-openjdk
systemctl enable jenkins
systemctl start jenkins
systemctl status jenkins
yum install epel-release
yum install nginx
getenforce
/usr/sbin/setsebool httpd_can_network_connect true
yum install -y setroubleshoot-server selinux-policy-devel
sepolicy network -t http_port_t
semanage port -m -t http_port_t -p tcp 8080
setenforce 1
getenforce

To get Jenkins setup password:

cat /var/lib/jenkins/secrets/initialAdminPassword

Open Browser: https://jenkinsserverip:8080 & copy the password to the browser

Now, Select default plugins and follow the instruction.

Create user account and click on finish

Now we will give root privilege to Jenkins user account.

cat /etc/passwd | grep jenkins
jenkins:x:998:996:Jenkins Automation Server:/var/lib/jenkins:/bin/false

modify the passwd file with below line (added bash in last)

jenkins:x:998:996:Jenkins Automation Server:/var/lib/jenkins:/bin/bash

Change jenkins user password:

passwd jenkins

Login with Jenkins User:

su - jenkins
ssh-keygen (use default value by pressing enter)
ssh-copy-id jenkins@localhost
"enter password"

from root shell

visudo

Add below line and save the file

jenkins ALL=(ALL) NOPASSWD: ALL

*********** setup completed in Jenkins Server ******************

jenkins
centos
6 VIEWS 1 LIKES 0 DISLIKES SHARE
1 LIKES 0 DISLIKES 6 VIEWS SHARE
Was this blog helpful?
You must be Logged in to comment
Code Block
Abhishek Jalan
DevSecOps Engineer
+21 more
17 Blog Posts
4 Discussion Threads
Trending Categories
93
Software12
DevOps34
Frontend Development13
Backend Development13
Server Administration13
Linux Administration12
Data Center14
Sentry11
Terraform15
Ansible9
Docker13
Penetration Testing12
Kubernetes12
NGINX8
JenkinsX10
Jenkins18
SSL6
Ethical-Hacking10
Python8
NodeJs9
RedHat8
Github11
AngularJs15
Google Cloud Platform (GCP)6
SonarQube9
Amazon Web Service (AWS)2
VMware17
Blockchain6
Snipe-IT7