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 - | sudo apt-key add -

sudo sh -c 'echo deb 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