How to Install Jenkins on Ubuntu 22.04 or 20.04 Linux

Learn the steps and commands to install Jenkins software on Ubuntu 22.04 LTS Jammy JellyFish or 20.04 Focal Fossa Linux.

Jenkins is a common software in the field of professional software development. When multiple developers are working on a software project, it gets confusing when all their changes are in place. To solve this problem, Jenkins comes into play. Jenkins is a continuous integration system (CI system) programmed in Java, which is used in agile software development: it ensures that small code changes are always immediately tested and imported into the software. Jenkins was first known as Hudson but after a dispute, all the developers involved in this (open source) project decided to rename it to Jenkins.

Therefore, in a nutshell, Jenkins is an open source project that helps software developers in development by automating various aspects of software application coding such as building, testing, and deploying…

Jenkins also supports Docker and Kubernetes as technologies that run microservices. To run Jenkin 4GB RAM and 50GB HDD would be good for small teams. In terms of software, it needs Java to run. At the time of writing this article, the supported version of Java was Java 8 and 11.

Steps to Install Jenkins on Ubuntu 22.04 or 20.04

1. Update Ubuntu 22.04 or 20.04

The first step is to refresh the APT package repository and install all available updates for the system. For all this, you just need to run the given command:

sudo apt update && sudo apt upgrade

2. Install OpenJDK

Although the user can opt for Oracle Java, we are opting here for Open source Java supported by Oracle and its community. The default version of OpenJDK available for installation is Java 11.

sudo apt install default-jdk

3. Add Jenkins GPG key on Ubuntu 22.04 or 20.04

The packages to install are not available in the default Debian 11 repository, so to add its repository first add the GPG key used to sign its packages.

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

4. Enable Jenkins Repository on Bullseye

After successfully adding the GPG key, let’s integrate the official Jenkins repository using the command below.

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

5. Run System Update

Once again, run the system update command using the APT package manager to refresh the cache and notify the system of the newly added repository.

sudo apt update

6. Install Jenkins on Ubuntu 22.04 | 20.04

Finally, we configured everything we initially needed to install Jenkins on our Linux operating system. Now, like other packages, use the APT package manager to install it.

sudo apt install jenkins

7. Check the service status

To confirm that Jenkins is working correctly without throwing an error, check its service using the given command:

systemctl status jenkins --no-pager -l

If the service is not running or active, you can use this one:

sudo systemctl enable --now jenkins

8. Find the Jenkins admin password

By default, the setup will assign an admin password to login to the Jenkins dashboard for the initial setup, which of course won’t be needed later once we create a new admin user. But initially, we need to find the same using the given command:

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

Copy the string of numbers to the output.

9. Access the web interface

Open your local or remote system browser that can access the domain or IP address of the server where you installed the Jenkins.

http://server-ip:8080

To note: Do not forget to open port 8080 in the firewall, if you are on the remote server. In your terminal, use:

sudo ufw allow 8080

Those who are on a cloud hosting server and need to whitelist the port in their service provider’s firewall.

On the web interface, enter the password you got in the previous step to securely start the setup process.

Access the Jenkins web interface

10. Install plugins

On the next screen, the installer will ask you to install plugins. You can either install all suggested plugins or select only the ones you want.

Install plugins on Jenkins

11. Configure user for administration

When you are done installing the plugin, in the next step, create your first admin user to login and use Jenkins in the future.

Setup user for Ubuntu 22.04 LTS administration

12. Jenkins Dashboard on Ubuntu 22.04

Finally, after following the few other steps, you will have your dashboard to start creating projects to test and develop with your developer’s team.

There are two architectures in which Jenkins works. Controller-agent architecture / controller-controller architecture

Agents can be configured on the “Nodes” page. Go ahead, enter node names, set node properties, assign agents to the controller, and then start the agent nodes. For more information, you can refer to his official documents.

New node in Jenkins Ubuntu 22.04

Other Items:

How To Install Oracle Java 8 64bit Ubuntu 22.04 | 20.04 LTS
How to Install Apache Tomcat 10 on Ubuntu 22.04
Increase swap space in Ubuntu 22.04…
How To Install Opera Browser On Ubuntu 22.04 | 20.04


Source link

Steven L. Nielsen