20.5 C
Texas
angeloma
Senior Writer and partner

How to install Jenkins in Ubuntu 18.04?

Continuous integration is a software development practice where team members integrate their work frequently (at least once a day, although multiple daily integrations are usually performed).

Each integration is verified by compiling the source code and obtaining an executable (this is called a build, and must be done automatically), and quality tests and metrics are also passed to detect errors as soon as possible.

Written in Java and accessible via web interface, Jenkins is multiplatform and has recently established itself as one of the most widely used tools for continuous integration tasks. By integration we mean the compilation and execution of tests of an entire project.

Why this?

In today’s world of DevOps, continuous delivery and deployment are critical to delivering high-quality software products faster than ever before. Some of the advantages of Jenkins is that it is an open source, continuous integration server written in Java.

- Advertisement -

Use Jenkins to automate your development workflow so you can focus on work that matters most. Jenkins is commonly used for:

  • Building projects
  • Running tests to detect bugs and other issues as soon as they are introduced
  • Static code analysis
  • Deployment

Execute repetitive tasks, save time, and optimize your development process with Jenkins.

Installing Jenkins

The first thing we need to do is to update the system to get the latest security updates:

                  sudo apt update && sudo apt -y upgrade

0.- Upgrading the system
0.- Upgrading the system

One of Jenkins’ dependencies is Java 8. So we have to install it.

                   sudo apt install openjdk8jre

1.-Installing java 8
1.-Installing java 8

This is because Ubuntu 18.04 comes with Java 9 by default, but Jenkins still uses Java 8, so if we try to install it, its execution will fail.

We then install a package necessary for Jenkinks installation to be effective.

            sudo apt install apt-transport-https

2.- Installing apt-transport-https
2.- Installing apt-transport-https

We now proceed to add the Jenkins repository. First we add the security key.

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

3.- Adding repository
3.- Adding repository key

And then, the repository is added as such

               sudo apt-add-repository “deb https://pkg.jenkins.io/debian-stable binary/”

4.- adding repository
4.- adding repository

Before installing Jenkins, we must “configure” java with the following command:

               sudo update-alternatives –config java

In the displayed box we indicate that the default Java should be 8.

5.- Setting java 8 to default
5.- Setting java 8 to default

Now we can install Jenkins from its added repository:

             sudo apt install jenkins

6.- Installing Jenkins
6.- Installing Jenkins

And we checked the status of the service:

             sudo systemctl status jenkins

7- checking status jenkins service
7- checking status jenkins service

In the previous image, we can notice that the service is running.

Before entering the Jenkins web panel, we must generate the administrator password:

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

8.- Showing the initial admin password
8.- Showing the initial admin password

Testing the installation

Now we can go to the web browser and access Jenkins on port 8080.

            http://IP_Server:8080

9.- Accessing to Jenkins
9.- Accessing to Jenkins

We set the administrator password andwe press continue button.

In the next window, you will be asked for user information, password and full name for set the first admin user.

10.-First admin user
10.-First admin user

Below is information from the Jenkins instance.

11.-Instance information
11.-Instance information

We click on “Save and Finish” and you are already telling us that we have installed Jenkins properly.

12.-Jenkins ready!
12.-Jenkins ready!

Now we’ll see Jenkins’ initial panel working.

13.- Welcome to Jenkins
13.- Welcome to Jenkins

Using this type of tools substantially increases productivity in companies that seek to automatically perform certain processes related to projects.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article