How to Install and Configure Jenkins on Centos 7
Table of Contents
- What is Jenkins
- Features of Jenkins
- Jenkins Architecture
- Installing Java
- Installing Jenkins
- Configuring Jenkins
What is Jenkins?
- Jenkins is an open source tool which is written in java.
- It can help us to run tasks that need to be executed once in a while.
- 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 Azure CI/CD tool.
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.
Here is how Jenkins works from the Build-to Deploying to Production Environment.
- Developers commit the code changes to the Remote Repository such as Bitbucket , GitHub , Gitlab etc.
- 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.
- 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.
- Jenkins will automatically deploy the latest built application code to the testing environment. Any failures during the deployment should be alerted to the respective Devops Solutions team.
- 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.
- 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.
- For installing jenkins , The user must need sudo permission or root user permission.
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.
Now let’s go ahead and Install Jenkins on Centos 7.
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
sudo rpm — import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
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.
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.
You may also read: How Cloud Services Transforming the Business World?
Fetch the administrator password using the below command.
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.
Jenkins is successfully installed in the Centos operating system.
There are no comments yet.