top of page

How to Install and Configure Jenkins on Centos 7

Jenkins

Jenkins is an open-source server that is written entirely in Java. It lets you execute a series of actions to achieve the continuous integration process, that too in an automated fashion. It has the ability to automatically deploy the code into the target instance whenever a developer commits changes to the source code , Hence it is referred to as CI/CD tool.


Some of the possible steps that can be performed using Jenkins are:

  • Software build using build systems such as Gradle, Maven, and more.

  • Automation testing using test frameworks such as Nose2, PyTest, Robot, Selenium, and more.

  • Execute test scripts (using Windows terminal, Linux shell, etc.

  • Achieve test results and perform post actions such as printing test reports, and more.

  • Execute test scenarios against different input combinations for obtaining improved test coverage.

  • Continuous Integration (CI) where the artifacts are automatically created and tested. This aids in identification of issues in the product at an early stage of development.


Read More:


Features of Jenkins

a. Easy to Install

Jenkins is a platform-agnostic, self-contained Java-based program, which makes it easy to run with packages for Windows, Mac OS, and Unix-like operating systems.


b. Configuration Made Easy

Jenkins provides a web interface using which we can easily configure it and also provides built-in help section.


c. Available Plugins

Jenkins provides hundreds of plugins which can be installed from the Jenkins web interface for integration with other CI/CD & build tools such as Maven, Git, Docker etc.

Plugin can installed either from the web interface or can be downloaded from the Jenkins official website.


d. Easy Distribution

Jenkins has the ability to spread the workloads across multiple servers to build applications faster, perform unit tests, and do deployments across multiple environments and infrastructure using the master-slave architecture.


Jenkins Architecture

Here is how Jenkins works from the Build to Deploying to Production Environment.



  1. Developers commit the code changes to the Remote Repository such as Bitbucket , GitHub , Gitlab etc.

  2. Jenkins will be configured in such a way that it keeps on checking the code changes on the remote repository at regular intervals and pulls the newly committed code.

  3. Then the Application will be generated either as a package or as a docker image. If there is any failure during the build process , notification will be sent to the respective developers.

  4. Jenkins will automatically deploy the latest built application code to the testing environment. Any failures during the deployment should be alerted to the respective Dev and Ops team.

  5. If the application is deployed successfully on the Testing environment and verified by the respective team , Then the code will be deployed into the Production Environment.

Sometimes , the Jenkins server won’t be able to handle the requests if it is hosted on a single instance.


Build process can utilize a lot of system resources


Inorder to have a successful build and deployment process , It is better to have a Jenkins setup with Distributed architecture by doing so load will be distributed across the agents.


Prerequisites

  1. For this tutorial we will use the Centos server which can either be created in On-premise and/or , it can be created as an EC2 Instance using AWS Console or any other cloud platform.

  2. For installing Jenkins , The user must need sudo permission or root user permission.


Installing Java

Jenkins requires java to work.


Using the below command install the java,


yum install java-11-openjdk.x86_64 -y


Check the version of Java installed in the centos system using the below command.


java -version


Now let’s go ahead and Install Jenkins on Centos 7.


Installing Jenkins

Centos Operating system has the repository for Jenkins by default , But it will not be an updated one.


To install the latest stable version of Jenkins , we have to add the official Jenkins repository to the system


Execute the below commands to add the key and repo,


sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo



Install Jenkins by executing the below command.


yum install Jenkins


Jenkins service can be started using the below command.


sudo systemctl start Jenkins


Executing the below command , The status of Jenkins service can be checked.


sudo systemctl status Jenkins.



To autostart the service on system bootup ,


sudo systemctl enable Jenkins



Jenkins listens on port 8080. The same can be checked by executing the following command.



The port 8080 should be whitelisted the firewall inorder to access the Jenkins console.


Configuring Jenkins

Access the Jenkins dashboard on the port 8080 using the below mentioned URL

http://server’s IP Address:8080


You will see the following page.


Fetch the administrator password using the below command.


cat /var/lib/jenkins/secrets/initialAdminPassword


Provide the password , click Continue


Next step is to Customize Jenkins ,


Let us choose Install suggested plugins ,



It will take some time for the plugin to be installed.


After the installation of suggested plugins , We can create an Admin user


This step can be skipped, But Let us create the user to Jenkins instead of usin the default admin credentials.



Provide all the required details ,then click Save and Continue


Provide the root URL and then click Save and Finish.





Jenkins is ready to use.

Click Start using Jenkins , You will be taken to the Main Jenkins dashboard.




Read More:



Source: Medium - Zenesys Technosys


The Tech Platform

0 comments

Comments


bottom of page