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.
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.
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
Execute repetitive tasks, save time, and optimize your development process with 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
One of Jenkins’ dependencies is Java 8. So we have to install it.
sudo apt install openjdk–8–jre
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
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 –
And then, the repository is added as such
sudo apt-add-repository “deb https://pkg.jenkins.io/debian-stable binary/”
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.
Now we can install Jenkins from its added repository:
sudo apt install jenkins
And we checked the status of the service:
sudo systemctl status jenkins
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
Testing the installation
Now we can go to the web browser and access Jenkins on port 8080.
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.
Below is information from the Jenkins instance.
We click on “Save and Finish” and you are already telling us that we have installed Jenkins properly.
Now we’ll see Jenkins’ initial panel working.
Using this type of tools substantially increases productivity in companies that seek to automatically perform certain processes related to projects.