Jenkins is an open source automation server written in Java. It is used to continuously build and test software projects, enabling developers to set up a CI/CD environment. It also supports version control tools like Subversion, Git, Mercurial, and Maven.
Jenkins is well-documented and extremely extensible, with a rich ecosystem of plugins and integrations. For that reason, it excels when used in large projects that require lots of customization.
In this article we will learn how to Install and Configure Jenkins as a Standalone server.
- In this demonstration, we will be using centos-07.
- We will be using 1 machine for our lab:
3. The memory should be at least 2 GB and there should be at least 2 core cpu.
Jenkins Configuration Steps:
- Setup hostname and update /etc/hosts File.
2. Enable epel-release repository:
3. Now Install Java Open Jdk software:
4. Now Enable Jenkins Repo using below command:
curl — silent — location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo
5. Now import gpg Keys. Run below commands to do so.
rpm — import https://jenkins-ci.org/redhat/jenkins-ci.org.key
sudo rpm — import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
6. Install Jenkins using “yum install jenkins -y”:
7. Now Enable and start Jenkins service:
8. Validate if the services are running fine:
9. Now open your web Browser, and type “192.168.33.90:8080” . You should see something like below.
10. Now go to your Jenkins sever and run following command. It will show you the Jenkins Administrator password. Insert the same password in the Unlock Jenkins Window where its asking for Administrator Password.
11. Once you do so, you should get the screen like below. Click on — “Install Suggested Plugins”:
12. Once Completed, you will see below screen asking you to create First Admin User. Fill Up the details like below and click on “save and continue”
13. You will see a screen like below. Click on “Save and Finish”.
14. The next screen you will see is something like below. Congratulations !!! Our Jenkins has now been installed and ready for use.
15. Now Click on “Start using Jenkins”, you will see the Jenkins dashboard like below:
16. Now go to “Configure Global security “ on your dashboard and Under “Security realm”, select “Jenkins own user database”. Select the checkbox “Allow users to sign Up”:
17. Now under “Authorization Strategy” section, select “Matrix Based Security”. Now click on “Add user or Group” and add the admin user — “rajeev” we had created earlier. Now select the checkbox underneath “Administrator”. Now click on “Apply” and “Save”.
!!! We have successfully setup “admin” user added him “Administrator” group.
A simple use case — Executing a shell script using Jenkins:
let’s now see a simple use case where we will be executing a shell script using Jenkins.
18. From the Jenkins Dashboard, click on “New Item”:
19. Now we will be creating a Team for which we will keep all the jobs at one place. Let’s name it as “Team1”. Select item type as “folder” and Click Ok:
20. Now Provide Basic Information like — Display name, Description and click “Save”.
21. You will see “Team1 Jobs” Item been created.
22. Now Click on “Team1 Jobs”, You will see something like below:
23. Now Again Click on “New Item” from the Jenkins Dashboard and fill Item Name as below. Select “Freestyle Project” as project time:
24. Now provide general description. Select the check box — Discard old builds. Fill out “Strategy” Information as mentioned below:
25. Now scroll down a bit. Under Build Section, select “Execute Shell Script”. You will see a screen like below. Now write a simple shell script to determine OS version and kernel version like below. Once done, click on save.
!!! You will see the job has been created now.
26. Now click on “Build Now” and underneath “Build History”, click on the “ball” icon and click on “Console Output”:
27. In the Console Output Screen, you will see that our Job has been successfully completed.
!!!Congratulations!!!, We have successfully Configured Jenkins and ran our first shell script successfully.
This concludes our tutorial for Jenkins Installation and Configuration.
Reading your article helped me a lot and I agree with you. But I still have some doubts, can you clarify for me? I’ll keep an eye out for your answers.
I have read your article carefully and I agree with you very much. This has provided a great help for my thesis writing, and I will seriously improve it. However, I don’t know much about a certain place. Can you help me?