Friday, 18 February 2022

Jenkins installation on Ubuntu 20.04

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'

5) Update system
sudo apt-get update

6) Install Jenkins.
sudo apt-get install jenkins -y

6) 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.



Click On Network and expand advanced button.


Click on Port Forwarding button and add a new port mapping as mentioned in below screen.


9) Once you finished above step you should able to access Jenkins on your favorite browser.


10) You need to copy the password from  /var/lib/jenkins/secrets/initialAdminPassword to text box and click on continue.

sudo cat /var/lib/jenkins/secrets/initialAdminPassword


11) Click on Suggested Plugin Installation. This will install all required plugins to start with CI & CD pipeline.






No comments:

Post a Comment