To get an overview of Jenkins go through this article
Prerequisites
- A Virtual Machine or an EC2 instance with Java 11 and EPEL repository
# Installing EPEL Release
sudo yum install https://dl.fedoraproject.ortg/pub/epel/epel-release-latest-9.noarch.rpm -y
# Installing Java 11
sudo yum install java-11-openjdk-devel -y
# Add below lines in .bash_profile file
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.16.1.1-3.el9.x86_64/
PATH=$PATH:$JAVA_HOME:$HOME/bin
export PATH
Installing Jenkins
- Setup of repository for Jenkins
# Downloading Jenkins repository
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
# Downloading Jenkins key
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
- Installing Jenkins
# Installing Jenkins
sudo yum install jenkins -y
- To start and enable Jenkins use the following commands
# Starting Jenkins service
sudo systemctl start jenkins
#Stopping Jenkins service
sudo systemctl enable jenkins
Jenkins runs on port 8080 and now you can access your Jenkins dashboard at the below URL
# URL
http://IP:8080
Configuration of Jenkins
The default username of Jenkins is
admin
The default password of Jenkins is located in
/var/lib/jenkins/secrets/initialAdminPassword
filePlugins can be installed later by going to
Manage Jenkins >> Manage Plugins >> Available Plugins
Password can be changed by going into
Manage Jenkins >> Manage Users
Configure the Java path by going into
Manage Jenkins >> Global Tool Configuration >> JDK
Configuring Test Jenkins Job
Create a new item
Enter the name of your project and choose freestyle project
Under the build section select Execute shell and enter “Hello World”
Save and build your job
Check the console output for the status of the job