Install Java
To run Jenkins your system need to have Java. So first we will install Java and then Jenkins.
Ubuntu:
Update the packages:
sudo apt update
Install Java:
sudo apt install openjdk-11-jre -y
Check installation:
java -version
CentOS/Fedora:
- Install Java:
sudo dnf install java-11-openjdk
- Install Java:
Install Jenkins
Ubuntu:
Install keys and setup (run commands one by one):
You can also refer to this official website for updated packages:https://www.jenkins.io/doc/book/installing/linux/
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
update packages:
sudo apt-get update
Install Jenkins:
sudo apt-get install jenkins -y
CentOS/Fedora:
Install keys and setup (run commands one by one):
You can also refer to this official website for updated packages:https://www.jenkins.io/doc/book/installing/linux/
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-2023.key
Packages Update:
sudo dnf upgrade
Install Jenkins:
sudo dnf install jenkins
Reload daemon:
sudo systemctl daemon-reload
Done. You have successfully installed Jenkins in your system.
Jenkins Status
Check the status of Jenkins with
systemctl
:
Stop Jenkins
Use
systemctl stop
to stop the Jenkins
Uninstall Jenkins
Stop Jenkins with
sudo systemctl stop jenkins
Remove the Jenkins packages
CentOS/Fedora machine:
sudo yum -y remove jenkins
Ubuntu:
sudo apt-get remove --purge jenkins
Remove the Jenkins Working Directory:
rm -rf /var/lib/jenkins
Remove User and Group:
sudo userdel jenkins
Reboot the system
sudo reboot now
Auto Remove Unwanted Packages(optional. Ubuntu):
sudo apt-get autoremove
Done. You have successfully removed Jenkins from your system.
To activate Jenkins and use it for automation, we will see it in another blog.
For further query do comment on this post.