Advance

Tutorial Install Jenkins on Ubuntu 20.04

In the following installation tutorials, in this article, you will learn about Tutorial Install Jenkins on Ubuntu 20.04. But first, let’s see what is Jenkins and why you need to install it. Also, we can say when it will be necessary. As a user, you may face with repetitive technical tasks. So it seems that finding automation solutions that work can be a good solution.

In this guide, you will see how this open-source automation server works to help you manage tasks from building to deploying software. While Jenkins is Java-based, it is installed from Ubuntu packages or by downloading and running its web application archive file, a collection of files that make up a complete web application to run on a server. You would be able to use it easily to set up continuous integration and continuous delivery (CI/CD) pipelines. To explain more, continuous integration (CI) is a DevOps practice in which team members regularly commit their code changes to the version control repository, after which automated builds and tests are run. Continuous delivery (CD) is a series of practices where code changes are automatically built, tested, and deployed to production.

 

 

Tutorial Install Jenkins on Ubuntu 20.04

Join us with this tutorial to verify how to install Jenkins on Ubuntu 20.04. In the following, you will start the development server and create an administrative user to get you started in exploring what Jenkins can do.

To let this tutorial work better, please consider the below Prerequisites:

One Ubuntu 20.04 server configured with root or a non-root user with sudo privileges.

To set up, follow our Initial server setup on Ubuntu 20.04.

At least 1 GB of RAM

Oracle JDK 11 installed, following our guidelines on installing specific versions of OpenJDK on Ubuntu 20.04.

 

 

 

Step 1: How to install Jenkins on Ubuntu

While you will find the default Ubuntu packages in the version of Jenkins. It is behind the latest available version from the project itself. However to make sure that you have the latest fixes and features, use the project-maintained packages to install Jenkins.

To start, use the following command and add the repository key to the system:

wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -

Once you add the key, the system will return with OK.

Now, let’s append the Debian package repository address to the server’s sources.list:

sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

After both commands have been entered, we’ll run update so that apt will use the new repository.

sudo apt update

And finally, run the command below to install Jenkins and its dependencies.

sudo apt install jenkins

 

 

Step 2: How to start Jenkins on Ubuntu

First, use the following command to start Jenkins.

sudo systemctl start jenkins 

You may receive no status output from systemctl. So use the status command to verify that Jenkins started successfully:

sudo systemctl status jenkins

In case the output status displays that the service is active and configured to start at boot, it means all is OK till here.

Output
● jenkins.service - LSB: Start Jenkins at boot time    Loaded: loaded (/etc/init.d/jenkins; generated)    Active: active (exited) since Fri 2020-06-05 21:21:46 UTC; 45s ago      Docs: man:systemd-sysv-generator(8)     Tasks: 0 (limit: 1137)    CGroup: /system.slice/jenkins.service

 

Step 3: How to Open the Firewall for using Jenkins

Again, use the Initial server setup on Ubuntu 20.04 to set up a UFW firewall. Since the Jenkins runs on port 8080 you should open that port using ufw:

sudo ufw allow 8080

Also, you can use the following commands to allow OpenSSH and enable the firewall, if you found the firewall inactive.

sudo ufw allow OpenSSH sudo ufw enable

Now, to confirm the new rules check UFW’s status.

sudo ufw status
Output
Status: active  To                         Action      From --                         ------      ---- OpenSSH                    ALLOW       Anywhere 8080                       ALLOW       Anywhere OpenSSH (v6)               ALLOW       Anywhere (v6) 8080 (v6)                  ALLOW       Anywhere (v6)

Point: Watch the notice which says traffic is allowed to port 8080 from anywhere.

 

Step 4: How to Set Up Jenkins on Ubuntu

In the final step, you will visit Jenkins on its default port, 8080 to set up your installation. To do this, use your server domain name or IP addresshttp://your_server_ip_or_domain:8080

When you receive the Unlock Jenkins screen, it means that you can see the location of the initial password

Unlock Jenkins screen on Ubuntu

 

Also, you can use the cat command in the terminal window to see the password:

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

At this point, Copy the 32-character alphanumeric password from the terminal and paste it into the Administrator password field, then click Continue.

By receiving the screen below, you can see the option of installing suggested plugins or selecting specific plugins:

customize jenkins on Ubuntu

Once, you click the Install suggested plugins option, the installation process would begin immediately.

Jenkins installation process page

 

When you finish the installation, you need to set up the first administrative user. You will face two choices, skip it or continue as admin using the initial password you used above, but you will take a moment to create the user.

create user page for jenkins on Ubuntu

 

So, you should enter the name and password for your user:

jenkins user info page

 

After all you should receive an Instance Configuration page that will ask you to confirm the preferred URL for your Jenkins instance. Confirm either the domain name for your server or your server’s IP address:

Jenkins's instance confirmation page

 

Click Save and Finish when you confirmed the appropriate information. Then wait for receiving a confirmation page confirming that “Jenkins is Ready!”:

jenkins on Ubuntu ready to use

 

Now, to visit the main Jenkins dashboard click Start using Jenkins.

home page of jenkins

 

 

In conclusion,

You have passed the 4 steps of this tutorial and installed Jenkins successfully. You learned how to use the project-provided packages, started the server, opened the firewall, and created an administrative user. So why are you waiting? start it and enjoy walking through its features.

 

Dear user, we wish this tutorial Install Jenkins on Ubuntu 20.04 would be helpful for you, to ask any question or review the conversation of our users about this article, please visit the Ask page. Also to improve your knowledge, there are so many useful tutorials ready for Eldernode training.

    Leave Your Comment

    Your email address will not be published.

    We are by your side every step of the way

    Think about developing your online business; We will protect it compassionately

    We are by your side every step of the way

    +1 805-421-4518

    7 days a week, 24 hours a day