Fast-Pace Jenkins Part-1

Rushabh Dudhe
2 min readJun 4, 2022

#Jenkins requires JDK to run

#Ubuntu installation steps

sudo apt-get update -y
sudo apt-get install openjdk-8-jdk -y
sudo apt install openjdk-11-jre -y
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update -y
sudo apt-get install jenkins -y

#refer https://www.jenkins.io/doc/book/installing/linux/#red-hat-centos
#RHEL/CentOS
sudo wget -O /etc/yum.repos.d/jenkins.repo \
https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm — import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
sudo yum upgrade
# Add required dependencies for the jenkins package
sudo yum install java-11-openjdk
sudo yum install jenkins
sudo systemctl daemon-reload

#Get the password from /var/lib/.. and select “Install suggested Plugins”.
#Meanwhile, you can checkout the jenkins logs at -> journalctl -u jenkins

#Jenkins default home on Linux: /var/lib/jenkins ($JENKINS_HOME)

#To change the Jenkins port and redirecting logs to a file,
#Go to ‘systemctl edit jenkins’ #It will open a blank editable, basically over-riding the defaults.
#Add the following line:
[Service]
Environment=”JENKINS_LOG=%L/jenkins/jenkins.log” #%L is for log folder
Environment=”JENKINS_PORT=8000"
#Save and restart jenkins

#To resolve port issues, use ‘ufw allow’ or ‘firewall-cmd — add-port=xxxx/tcp — zone=public — permanent’

By default, all jenkins users are admins.
To have RBAC for users, we have to use a plugin called “Role Based authorization Strategy”. Then enable “Role based Strategy” under ‘Configure Global Security’ -> ‘Authorization’ to use the plugin.

### Jenkins File Structure

pipeline {
agent any #any of the nodes

stages {
stage(‘Dev’) {
steps {
echo “test this thing”
}
}
stage(‘UAT’) {
steps {
echo “ok next”
}
}
}
}

--

--

Rushabh Dudhe
0 Followers

Insane curiousity amongst a wider array of topics. Not sure if this lifetime will be enough.