In this article, we will see what Jenkins software tool is all about and also look into its installation process on an Ubuntu based machine. Firstly let us understand what Jenkins is all about and why / where this software tool can be put to use?
Jenkins is a very powerful automation platform that makes it relatively easy to automate the build process (through ANT), regression testing and also the integration. Jenkins also monitors execution of repeated jobs, focuses on building / testing software projects continuously. There are quite a few reasons why you would want to do this, as mentioned below:
1) It helps the developer’s time being focused on things that matter. With newer code blocks added to the same functionality, your developer doesn’t need to worry further on testing it as running regression tests with Jenkins is pretty simple. This means that developer time is not compromised with something that is not required.
2) It helps in the improvement of software quality. With Continuous integration, identifying issues caused by newer check-ins can be identified and resolved earlier than being reported at a later stage of design and development.
3) It ensures faster development, as the likelihood of any integrations issues are lesser and also the whole part of integration is also automated.
The points mentioned above are good enough reasons for someone not using Jenkins in their development ecosystem to use it, but let us take a look in to its advantages further to cement its requirement:
1) Jenkins is tool that is available open source with strong community support.
2) Jenkins installation is much easier.
3) Jenkins has a surplus of 1000 and counting plug-in’s support.
4) Jenkins provides a provision to create a new Jenkins plugin if one is not available.
5) Jenkins is written in Java, hence its easier portability on almost all the major platforms.
The basic pre-requisite to install Jenkins is to have the Java installation proper. You can cross-check your Java installation if it is proper or not with just checking the version of the Java installed using this command.
# java -version
Before we proceed with the installation of Jenkins on our own Ubuntu machine, you need to make sure that the key and source list are added to apt. This process will be done in two steps, first by adding the key
# wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
Then creating a sources list for Jenkins (as shown below)
# sh -c 'echo deb https://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
Once these two steps are done, then we are one more step closer to the installation of Jenkins software on our Ubuntu machine. We now have to update the apt’s cache before installing Jenkins on the system (shown as below):
# apt-get update
Once the cache has been updated successfully, then we may proceed with the installation of Jenkins. Since the installation of Jenkins might require to resolve quite a few number of dependencies, it might take a while in the installation. The Jenkins installation can be triggered using the following command (as shown below):
# apt-get install jenkins
Jenkins will be launched as a daemon up on start. We can check /etc/init.d/Jenkins for more details on the same. To run the service, a user jenkins is created. The log files will be created under the /var/log/Jenkins/Jenkins.log as this can helpful while troubleshooting any issues further in the installation or the like.
Once configuring Jenkins instance is completed, we will use the systemctl command to start the created Jenkins instance (as shown below)
sudo systemctl start Jenkins
The command above doesn’t display anything in the output, hence we will use the status command to verify whether it is started successfully or not.
$ sudo systemctl status jenkins
Now that the Jenkins service is up and running, let us take the last leg of the installation process by adjusting the firewall rules so that we can reach Jenkins from a Web Server to complete. By default, Jenkins runs on the port 8080 and hence we will open that port using the ufw command (as shown below):
$ sudo ufw allow 8080
$ sudo ufw status
Once the installation is successful, the installed Jenkins instance can be accessed on any of your favorite browsers using the following URL: https://domain_name_or_ip_address:8080. By default, Jenkins always runs on the port 8080 (hence any issues on port already in use can be resolved accordingly).
In this article the basics of Jenkins and the prerequisites that are required for the Jenkins installation on an Ubuntu machine are provided in great detail. Hope this article was clear enough and has helped you in successfully installing Jenkins on your Ubuntu machine. Jenkins is a software tool written in Java, so it should be working on almost all the environments and should help you get further on your Continuous Integration with any codebase of your choice.
Get Updates on Tech posts, Interview & Certification questions and training schedules