How to Install Jenkins on Ubuntu Server

Jenkins is a popular open-source automation server that helps develop and deploy software projects. In this tutorial, we'll guide you through the process of installing Jenkins on Ubuntu Server.

Prerequisites

Step 1 — Update and Upgrade Ubuntu

First, it is recommended to update and upgrade Ubuntu to ensure that all software packages are up to date. Run the command below to do this:

sudo apt update && sudo apt upgrade

Step 2 — Install Java

Jenkins is a Java-based system, so we'll need to install Java Development Kit (JDK) to run Jenkins. Run the command below to install the latest version of OpenJDK:

sudo apt install -y default-jdk

Verify the installation by checking the Java version with the following command:

java -version

Step 3 — Add Jenkins Repository

Next, we need to add Jenkins repository to our Ubuntu server. Run the following commands to add the GPG key and the Jenkins Debian package repository:

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'

Step 4 — Install Jenkins

Update the package list and install the latest version of Jenkins by running the following commands:

sudo apt update
sudo apt install -y jenkins

Step 5 — Start Jenkins

By default, Jenkins is not started automatically after installation. You can start the Jenkins service with the following command:

sudo systemctl start jenkins

Check the Jenkins service status with the following command:

sudo systemctl status jenkins

Step 6 — Access Jenkins Web Interface

Jenkins is now installed and running on your Ubuntu server. Access the Jenkins web interface by opening a web browser and going to http://YOUR_SERVER_IP:8080. You should see the Jenkins login page.

To unlock the Jenkins dashboard, you need to retrieve the initial admin password. You can find the password in the following path:

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

Copy the password and paste it on the Jenkins login page. Click on the Continue button and follow the prompts to complete the setup.

Summary

In this tutorial, we showed you how to install Jenkins on Ubuntu Server. You can now use Jenkins to automate your software development processes.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!