Update packages and then install the default jdk
sudo apt update && sudo apt upgrade -y
sudo apt install default-jdk
We’re here using wget to pull the key for the debian repository. This command will return OK.
wget -qO - https://pkg.jenkins.io/debian-stable/jenkins.io.key | apt-key add -
Add the app debian repository
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
Update packages cache and then proceed with the installation.
sudo apt update
sudo apt install jenkins
Enable jenkins to start after reboot
sudo systemctl enable --now jenkins