How to Install Jenkins on Ubuntu Server

Modern MuleSoft setups demand a DevOps-first approach to manage the full application lifecycle— from design and build to deployment and operations. Automating build and deployment pipelines improves consistency, reduces manual errors, and enables faster, more reliable releases across environments. 

For many MuleSoft customers, Jenkins remains the most common CI/CD choice due to its maturity, flexibility, rich plugin ecosystem, and strong support for Maven-based Mule projects. Jenkins also fits well with enterprise security, on-prem, cloud, and hybrid deployment models commonly seen in MuleSoft landscapes.

In the next couple of posts, we’ll see how we can install Jenkins on an Ubuntu server and how to configure Jenkins, including plugins, credentials and pipelines to build and deploy Mule applications using the Mule Maven plugin.


Prerequisites

Before starting, a minimum baseline configuration is required to ensure Jenkins runs reliably and can support MuleSoft CI/CD workloads. 

In this tutorial, we will use an Ubuntu 20.04 or 22.04 LTS server, with sudo/root access and network access on port 8080 for the Jenkins UI. For Mule builds and deployments, we’ll also need outbound connectivity to our Git repositoryand Anypoint Platform.

Install Java

Jenkins needs Java to run; OpenJDK is recommended. Follow this steps to install version 17 of OpenJDK. If you want to get more details about this step, check out this post on How to install Java on Ubuntu Server

First, we check if Java is installed

java --version

If Java is not installed, we’ll run the following commands:

sudo apt-get update
sudo apt-get install openjdk-17-jdk -y
java -version

After that, we’ll set the JAVA_HOME environment variable. For that, check where the jdk has been installed on the system

sudo update-alternatives --config java

Then create the JAVA_HOME variable and make it persistent modifying the .profile file. 

vi ~/.profile

Add the following lines at the end of the file:

JAVA_HOME='/usr/lib/jvm/java-17-openjdk-amd64'
PATH="$PATH:$JAVA_HOME/bin"
export JAVA_HOME
export PATH

To make changes take effect immediately run the source command:

source ~/.profile

Verify the JAVA_HOME has been created and it’s pointing to the right path.

env


Install Jenkins

Add the new Jenkins repository key (correct 2025 method)


curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | \
sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null

Confirm the key exists:

ls -l /usr/share/keyrings/jenkins-keyring.asc


Add the Jenkins repository pointing to the key


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


Update package list


sudo apt-get update

Install Jenkins

sudo apt-get install jenkins -y


Start and Enable Jenkins

Once Jenkins has been installed we’ll use the systemctl tool to install it as a service of the operating system. This way Jenkins will be started every time we restart the Ubuntu server.

sudo systemctl enable jenkins
sudo systemctl start jenkins
sudo systemctl status jenkins


Retrieve Initial Jenkins Password

When we install Jenkins on a server, the installer will generate a password that we’ll need to use for the initial setup. To retrieve the password we’ll run the command:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword


Complete the Web-based Setup

Now we need to complete the initial setup for Jenkins. Open a browser and type the following url, using the ip or dns name of your jenkins server:

http://<your-server-ip>:8080

If the installation was successful and Jenkins is up and running you should see the prompt for the initial password that we retrieve in the previous step. Paste that password and continue



After that, Jenkins will install the plugins. For that you can choose between a custom installation, where you’ll decide which plugins to be installed or you can start by installing the suggested plugins. If you’re not an advanced user probably the latter is the best and quickest option.



After your selection, it will take a few minutes for Jenkins to install the selection of plugins



Once the plugins have been installed, Jenkins will prompt you to create the username and password of the first admin user.



As a last step, the installer will ask for the URL we’ll use for our Jenkins server. In here, we’ll type the dns name of our server typically




With that our Jenkins is ready to go!


Click on Start using Jenkins and you’ll get to the home page




Congratulations, you’ve just installed Jenkins on Ubuntu server. In the next post, we’ll see how to set up our Jenkins server to build and deploy mule apps, in particular using the mule maven plugin.

Previous Post Next Post