Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install Jenkins on Ubuntu 22.04

Install Java and Jenkins from the official repository, then unlock Jenkins in your browser.

VPS and Cloud Servers2 min read7 screenshots

System requirements

Minimum

  • 256 MB of RAM
  • 1 GB of disk space (10 GB if you run it in Docker)

Recommended

  • 4 GB of RAM or more
  • 50 GB of disk space or more

Step 1: Update Ubuntu

sudo apt update && sudo apt full-upgrade
Updating the system

Step 2: Install Java

sudo apt install openjdk-17-jdk
Installing OpenJDK

(Recent Jenkins versions need Java 17 or 21. Older ones ran on Java 11.) Check it with java -version.

Step 3: Add the Jenkins repository and install

Download the repository key:

sudo wget -O /usr/share/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
Downloading the Jenkins key

Add the repository:

echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
Adding the Jenkins repository

Install Jenkins:

sudo apt update && sudo apt install jenkins
Installing Jenkins

Step 4: Check the service

sudo systemctl status jenkins
The Jenkins status

Start and enable it if needed:

sudo systemctl enable --now jenkins

Step 5: Open the firewall

Jenkins uses port 8080:

sudo ufw allow 8080

Step 6: Unlock Jenkins

Open http://your_server_ip:8080 in your browser.

Jenkins asks for the first admin password. Read it from the server:

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

Paste it into the Unlock Jenkins page.

The Unlock Jenkins page

Choose Install suggested plugins, create your admin user and set the Jenkins URL. Jenkins is ready.

Tip: Put Nginx with HTTPS in front of Jenkins, and do not leave port 8080 open to the internet.

Quick recap

  • Install Java 17, add the Jenkins repository and install.
  • Open port 8080.
  • Unlock Jenkins with the password from initialAdminPassword.