Jenkins is an OpenSource automation tool, written in Java for the purpose of Continuous Integration. Jenkins is a build tool that makes easier for developers to build and test their projects continuously, making it easier for the users to obtain a fresh build. Jenkins provides various plugins for integrating with various testing and deployment technologies.
Jenkins accelerates the software development process using automation and integrates development life-cycle processes like, build, documentation, test, package, staging, deployment as well as static code analysis.
Jenkins achieves Continuous Integration with the help of plugins which are used to integrate various DevOps stages. If we want to integrate a particular tool, we have a plugin for that. We can integrate a wide range of tools like, Maven, Selenium, Git, Puppet, NagiOS and Ansible being some of them.
Advantages of Jenkins :
- OpenSource + great community
- Easy installation
- Support wide range of plugins
- Free of cost
- Highly portable
Before Jenkins | After Jenkins |
---|---|
Entire Source code build and tested at the end so it is difficult and time-consuming to fix the bugs. | Every commit is build and tested so developers need to focus on a single build rather than checking the whole source code. |
Developers have to do the whole process manually. | The whole pipeline is automated so no manual intervention required. |
Developers need to wait for the test result. | Test result is provided after every commit. |
Installing Jenkins in Linux
Pre-Requisites
1) Java installed
2) Our machine configured with a non-root sudo user.
Installing Java8
1) First update the package indexes using the command,
sudo apt update
2) Install java using the following commands,
sudo apt-get install default-jre
sudo apt-get install default-jdk
In case we have multiple versions of Java installed we can configure them using the command
sudo update-alternatives --config java
Installing Jenkins
1) The version of Jenkins available with default Ubuntu is far behind the latest versions so we need to add the Jenkins repository to our system,
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
2) As the key is added, we need to append the package repo to sources.list,
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
3) Update the apt repository to use the new repo,
sudo apt update
4) Install Jenkins and its dependencies,
sudo apt install jenkins
5) We need to start the Jenkins services on our linux device and then we can check it's status using,
sudo systemctl start jenkins
sudo systemctl status jenkins
If we are using our Jenkins on our server machine we need to allow our devices to connect to it by allowing it in the firewall
sudo ufw allow 8080
6) For accessing our jenkins, we need to open the following URL,
http://your_server_ip_or_domain:8080
For local devices the IP used will be 127.0.0.1:8080
7) We need to unlock our Jenkins by accessing the following file,
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
8) After unlocking the Jenkins, install the suggested plugins, create user
9)After compilation, we can access our jenkins dashboard using the specified ip
Creating first Jenkins Job
1) Create a job by selecting new item from the Jenkins dashboard.
2) Enter the item name and select a freestyle project.
3) Under the build section select execute shell and type the command you want to run on build execution.
4) Select the project and click build now option.
5) See the output by clicking on build number and clicking
Console Output.
Top comments (0)