Run the following command to add the repository key to your system:
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
When the key is added, the system will return OK.
Next, we will append the Debian package repository address to the server's sources.list by running this command:
echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list
Next, we need to update the repositories in the system by running the following command:
sudo apt-get update
Make sure to install Java as it is a dependency for Jenkins to run, so run the following command:
sudo apt install openjdk-9-jre
Next, we install Jenkins onto Ubuntu:
sudo apt-get install jenkins ...