how to install jenkins in ubuntu proper way

Get Complete setup for how to install Jenkins on ubuntu 18.04, 19.04,20.04, 21.04, 22.04

Not taking your time just go to installation steps

Requirements: java developement kit (JDK)

Step 1 Remove older packages

sudo apt remove jenkins -y
sudo apt-get -y autoremove

Step 2 Get JDK and update

sudo apt-get install openjdk-8-jdk
sudo apt update -y

Step 3 Install the latest version of Jenkins on Ubuntu

wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -

sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

sudo apt-get update

sudo apt-get install jenkins

Step 4 Finally, check version in Ubuntu

jenkins --version