Steps to Use the Script
Create a file name Jenkins.sh
Copy and paste the below script and save the file.
Make the Jenkins.sh file executable.
Run the script.
#!/bin/bash
sudo apt update
sudo apt install openjdk-11-jdk -y
sudo apt install maven -y
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.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
sudo apt-get install jenkins -y
Check if Jenkins is installed or not by the command:
systemctl status jenkins
You will see something like this in your shell.
Congratulations you have successfully installed Jenkins.
What does this script do?
Install dependencies like Java, JDK, and Maven.
Then install Jenkins.