1) Update System
sudo apt-get update && sudo apt-get upgrade -y
2) Install open-jdk
sudo apt-get install openjdk-11-jdk -y
3) Add Jenkins key.
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
4) Configure Jenkins repo.
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
5) Update system
sudo apt-get update
6) Install Jenkins.
sudo apt-get install jenkins -y6) Once Installation of Jenkins is completed start jenkins service.
sudo systemctl start jenkins
7) Enable Jenkins service to be restart on system reboot
sudo systemctl enable jenkins
8) By Default Jenkins will run and accessible over 8080 port. We need to open port to access in our browser if we are using Jenkins on Virtual Environment.
i) If you are using Vagrant please add below line to Vagrantfile and restart vm.
config.vm.network "forwarded_port", guest: 8080, host: 8080
ii) If you are using Oracle VirtualBox please follow below steps to open 8080 port
Right Click on VM and go to settings.
10) You need to copy the password from /var/lib/jenkins/secrets/initialAdminPassword to text box and click on continue.