Getting started with Jenkins on Ubuntu 20.04

Jenkins is a Java-based open source server that provides plugins for a variety of automation problems. Be it the automation of the programming of new software or its assignment to a specific task with Jenkins; you can do everything.

This walkthrough covers installing Jenkins on Ubuntu 20.04. We’ll also cover the needs to get started with Jenkins, including starting a development server with Ubuntu and logging in with an administrative user account.

How Jenkins works

To put it simply, Jenkins automates your projects, namely creating and testing them, and in turn, makes it easy to incorporate various changes that come with expanding the scope of your project. It also makes it easier to keep the updated software available on an ongoing basis by merging it with multiple testing and deployment tools.

Jenkins can save your company a lot of time and tons of resources with its automation plugins that integrate the entire project lifecycle: create, evaluate, demonstrate, package, deploy and deploy phases.

It supports Windows, Mac OS and Linux / Unix OS and can be distributed on different computers.

Our setup

Here in this guide we are using an Ubuntu server with a sudo access user account that has Oracle JDK 11 installed. We will be using the officially updated packages to install Jenkins.

Step 1: prepare the server

We start by adding the repository key to the system with the following command:

$ wget -Q – https://pkg.jenkins.io/debian stable/jenkins.io.key | sudo add apt key

Then proceed to add the address of the Debian package repository to the server’s sources.list:

$ sudo NS -C ‘echo deb https://pkg.jenkins.io/debian-stable binary /
> /etc/apt/sources.list.d/jenkins.list ‘

Next, switch to the new repository using the following command.

$ sudo apt update

Step 2: install Jenkins

When the server is ready to install, enter the following command to start the installation:

$ sudo suitable To install Jenkins

Installation may take a while. If installed from the packages managed by the project, it should have all of the latest features available.

Step 3: cheer on Jenkins

Enter the following to start Jenkins:

$ sudo systemctl start Jenkins

To view the status output, use the status input to see whether the start was successful:

$ sudo systemctl-status Jenkins

If you’ve followed the instructions correctly so far, you should see the output exactly as in the screenshot above.

The output panel confirms that Jenkins is set up to start as soon as the machine boots.

Although we’ve confirmed the installation was successful, we should tweak our firewall settings to link the setup from a web browser.

Step 4: Configure the firewall

First, let’s make some adjustments to the firewall. Jenkins’ default settings run it on port 8080. To access this port, enter:

$ sudo ufw allow 8080

This would activate the firewall if it was not activated prior to installation.

$ sudo ufw allow OpenSSH

$ sudo ufw activate

Check the status update with:

$ sudo ufw status

See port 8080 open to traffic from across the web.

Now that we’ve installed Jenkins on our server and adjusted our firewall, we can finally start adjusting Jenkins.

Step 4: adjust the settings of Jenkins

Before we set up the installer, we need to access Jenkins port 8080 with our credentials. It should take you to the Unlock Jenkins panel where you can see where the initial password was.

Switch to the terminal window and retrieve the password with the cat command:

$ sudo cat /Where/lib/jenkins/Secrets/initialAdminPassword

Write down or save the password displayed in the window, go to the Administrator Password dialog box and paste it there. Next you will be asked if you want to customize the plugins to install them yourself or if you want to use the default plugins.

Here we just clicked the Install button as you can see. Once the installer finishes, a prompt will appear for the administrator user credentials. You can use the 32-digit alphanumeric password as your password and continue as administrator or create a new user as follows.

Then you will be shown and ‘Instance configuration’ Panel in which you confirm the URL for your Jenkins instance. You can either confirm with your server’s domain name or its IP address:

After confirming the required information, you can exit the process by clicking the Save and Finish button. You will receive a message with the following wording:

Go to the Jenkins dashboard by clicking the Launch button with the Jenkins button.

If you followed the above steps correctly, you should have the latest version of Jenkins installed on your system.

Pack things up

In this article, we’ve looked at Jenkins, how to install it, and what packages it requires. Hope you found this tutorial useful and it helped you get Jenkins up and running on your Ubuntu 20.04 server.

Related Posts