How to Install and Configure Jenkins on Ubuntu
Jenkins is the most sought-after tool used for automating software development. The automation software allows you to easily integrate various DevOps stages in your project.
Jenkins has great community support. The best thing about the tool is that it is easy to install and learn on any Linux system. Let’s see how you can install and configure Jenkins on Ubuntu 22.04.
What Is Jenkins?
The leading automation server in the market, Jenkins is a free and open-source system that helps in the building, testing, and deploying stages of software development to achieve fast deployment of applications in a production environment.
With this tool, you can set up a continuous integration and continuous delivery (CI/CD) environment for any combination of languages and source code repositories with the help of pipelines.
Jenkins also has support for Slack. A large team of developers and DevOps engineers require a platform to collaborate in a work environment. For this purpose, it’s possible to integrate Jenkins with Slack.
It also offers various plugins that help in building, deploying, and automating any project. According to the Jenkins community, there are around 1,500 plugins available for various applications.
Prerequisites to Install Jenkins on Ubuntu
Before getting started with Jenkins installation, you need to make sure that your system meets the following requirements:
- Ubuntu 22.04 server installed
- SSH access to the server
- A non-root sudo user
- Access to Ubuntu’s command line
- At least 256MB of RAM
- 1GB of drive space for solo use
- 10GB of drive space if Jenkins runs inside a Docker container
- 4GB+ of RAM for group use
- 50GB+ of drive space for group use
- Java Development Kit 8 or 11
- NGINX or Apache installed and configured on Ubuntu Server
If your system fulfills these requirements, you are good to go.
How to Install Jenkins on Ubuntu
Here are the steps to install Jenkins on Ubuntu:
Step 1: Install Java Development Kit 11
Jenkins is written in the Java programming language. For it to function, you either need the latest version of Java Development Kit (JDK) or Java Runtime Environment (JRE).
To install Java Development Kit, it’s recommended to first update and upgrade your Ubuntu system using the following commands:
sudo apt-get update
sudo apt-get upgrade
Jenkins supports both Java Runtime Environment 8 and 11. You can install Java 11 on your system using this command:
sudo apt-get install openjdk-11-jdk
Now, verify if the correct version of Java has been successfully installed with:
You will see an output stating that OpenJDK version 11 has been installed.
Step 2: Install Jenkins on Ubuntu
Install Jenkins by issuing the following command:
curl -fsSL https:
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https:
For the new changes to take effect, run:
sudo apt-get update
Once the changes have been updated, execute the following command to install Jenkins:
sudo apt-get install jenkins
When prompted for confirmation, enter Y and hit Enter to begin the installation process.
Step 3: Start Jenkins on Ubuntu
Once you’ve installed Jenkins, start the service on Ubuntu with this command:
sudo systemctl start jenkins.service
You can verify the Jenkins service status with:
sudo systemctl status jenkins
If it is running fine, you will see the following output on the terminal:
Step 4: Set UFW Firewall Rules for Jenkins
Jenkins, by default, uses port 8080. To make sure this port is accessible, you need to adjust firewall rules with UFW.
To allow port 8080 to listen to upcoming connections, issue the following command:
sudo ufw allow 8080
If the rules are successfully updated, you will see a confirmation message on the command line stating the same.
Next, enable UFW with this command:
sudo ufw enable
Check the status of UFW by typing:
sudo ufw status
In the output, you will see that port 8080 has been allowed and is actively listening for new connections.
Step 5: Access the Jenkins Dashboard on a Web Browser
To launch and configure Jenkins, open a browser, and enter the IP address of your server in the following format:
If you are running Jenkins locally, you can access it using:
To unlock Jenkins, you need to authenticate yourself by providing the password kept in the /var/lib/jenkins/secrets/initialAdminPassword file.
The file permissions don’t allow a normal user to access it as it is a password file. Open the command line and run the following command to become a root user.
Now run the following command to get the password from the file:
You will find an alphanumeric code like this:
Copy the code and paste it into the box under Administrator password and click Continue.
Essential Configurations for Jenkins
After accessing the Jenkins web interface, you need to make some necessary configurations.
1. Install Plugins for Jenkins
Jenkins makes use of plugins for continuous integration. To integrate a particular tool, you need to install the plugins for the particular tool, like HTML Publisher and Amazon EC2.
To install plugins, click on Install suggested plugins.
This is the interface you’ll use to install the plugins.
2. Create an Administrator Account for Jenkins
Once you’ve installed all the necessary plugins, Jenkins will prompt you to create an admin user account. Provide the username, password, and e-mail address to create the admin account.
Now click Save and Continue. Once the account is created, you will be ready to use Jenkins. Click on Start using Jenkins to continue:
After the initial configuration, you will be able to access the Jenkins Dashboard.
How to Uninstall Jenkins From Ubuntu
When you want to remove Jenkins from Ubuntu, run the following APT command:
sudo apt remove
Deploy Applications Much Faster With Jenkins on Ubuntu
After the initial configuration of Jenkins, you can begin continuous integration and continuous deployment and monitor pipelines on the Jenkins dashboard. With Jenkins, you can now automate tasks, deploy code, increase code coverage, improve code efficiency, make audits simple, and so much more.
Thanks to Jenkins’ intuitive interface and simple framework, DevOps engineers can now deploy applications more efficiently in production environments.