How to Install & Configure Jenkins Integration tool on Linux

jenkins, install jenkins, how to install jenkins, configure jenkins, how to configure jenkins, what is jenkins, jenkins integration tool, installing jenkins

This post shows you how to install and configure Jenkins integration tool with step by step procedure on CentOS & RHEL 7 linux servers.

What is Jenkins?

Jenkins is an open source automation tool which helps us to automate the regular jobs for continuous integration (CI) and continuous delivery (CD).

Steps involved in this post are,

1. How to install Jenkins using Yum and Rpm
2. How to configure Jenkins user with Sudo access
3. How to change jenkins user shell for interactive session
4. How to enable and start Jenkins Service
5. How to allow Jenkins port in firewall.
6. How to Setup Jenkins portal ready for first job

How to Install and Configure Jenkins Integration tool

Our Lab Environment:
Operating System: CentOS 7.2 - 64 Bit
IP address: 192.168.2.1
Yum configured : Yes - If you have not configured yum, please refer this link how to configure yum repo server in linux.
Required Dependencies : Java ( yum -y install java)

Lets get started.

Also Watch this "Jenkins Installation and Configuration" Tutorial video demo on our YouTube Channel.


1. Install Jenkins using Yum and Rpm

Before installing Jenkins, make sure java is installed. If it is not installed, install Java using yum repository. Please refer this link, If you are not sure about How to Configure Local YUM Repo Server in Linux.
[root@jenkins-server ~]# yum -y install java
Using YUM:
Enable the repo file for installing jenkins packages directly from the jenkins repository.
[root@jenkins-server ~]# wget -O /etc/yum.repos.d/jenkins.repo \
https://pkg.jenkins.io/redhat/jenkins.repo
[root@jenkins-server ~]# rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
[root@jenkins-server ~]# yum -y install jenkins
or

Using RPM:
Download the latest jenkins version from jenkins.io official website https://pkg.jenkins.io/redhat-stable/ and copy it to the server directory to install using rpm command.
[root@jenkins-server ~]# rpm -ivh jenkins-2.89.4-1.1.noarch.rpm
Lets configure Jenkins Integration tool.

Bydefault, user "jenkins" is created during the installation at the OS level, but it is a non-root user.

Whatever Users created in jenkins portal are only for creating different jobs. Bydefault, user "jenkins" only runs everything in background even if you have loggedin using any users on portal.

So when user "jenkins" doesnt have sufficient previleges at the OS level, this user cannot perform any administrative level tasks. So we must configure sudo to gain the administrative level access.

Lets do that.


2. How to configure Jenkins user with Sudo access

[root@jenkins-server ~]# visudo
Edit /etc/sudoers file and add below entry to allow user "jenkins" to use sudo with nopasswd prompt and also disable requiretty option..
jenkins ALL=(ALL)  NOPASSWD: ALL
Defaults    !requiretty
3. How to change jenkins user shell for interactive session
[ads-post]
Change user "jenkins" shell to /bin/bash from /sbin/nologin for interactive session. Also you can use this user "jenkins" to login into all build server and slave servers for advanced tasks. It must be looks like below output after the change.
[root@jenkins-server ~]# cat /etc/passwd | grep -i jenkins
jenkins:x:995:992:Jenkins Automation Server:/var/lib/jenkins:/bin/bash
4. How to enable and start Jenkins Service

Use systemctl command to enable and start jenkins service.
[root@jenkins-server ~]#systemctl enable jenkins
[root@jenkins-server ~]#systemctl start jenkins
Note: Service may get failed if java is not installed. Kindly install java (yum -y install java) then start the service again.

5. How to allow Jenkins port in firewall
Lets allow default jenkins port 8080 in firewalld to accept the connections.
[root@jenkins-server ~]# firewall-cmd --permanent --add-port=8080/tcp
[root@jenkins-server ~]# firewall-cmd --reload
We have successfully completed the Jenkins installation and configuration, Lets do some initial setup on Jenkins automation tool.

6. How to Setup Jenkins portal ready for first job
Once the installation and configuration of jenkins is completed, we will be able to access the jenkin dashboard.

Open your browser and enter the url "http://192.168.2.1:8080". Replace "192.168.2.1" with your server ipaddress.

Once you have hit enter, you would get an welcome screen as below to unlock jenkins.

Getting started with Unlock Jenkins

jenkins main dashboard

Initial Admin Password is available in a file "/var/lib/jenkins/secrets/initialAdminPassword" to unlock jenkins tool.
[root@jenkins-server ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
661efd2f988541bda823dd7391f462af
Copy that password, enter in the password box and click continue. Next screen would be for plugins installation.

Getting started with Customize Jenkins

jenkins plugin install welcome screen

Plugins are required for integrations to support many different needs for additional features. There are two options given in the jenkins dashboard to install plugins as shown in the above image.

1. Install suggested plugins
2. Select plugins to install

We can install plugins even later, so just close this window for right now.


Click start using jenkins.

Lets reset the admin password, so we dont need to use this file for encrypted admin password from /var/lib/jenkins/secrets/initialAdminPassword.

start using jenkins

Go to the menu "people" available at the left side and select the user "admin"

jenkins reset admin password

Enter the new password at the password change box and click save.

reset jenkins admin password

Thats it. Logout and login again with new admin password.

Hope you have got an idea how to install and configure Jenkins automation tool. Going forward, we will play more jenkins tool. Keep practice and have fun. jenkins, install jenkins, how to install jenkins, configure jenkins, how to configure jenkins, what is jenkins, jenkins integration tool, installing jenkins, setting up jenkins tool, jenkins install, jenkins installation, jenkins configuration
Support Us: Share with your friends and groups. install jenkins on linux, install jenkins on centos, install jenkins on redhat, install jenkins on rhel 7, how to install jenkins on linux, how to install jenkins on centos, install jenkins linux, install jenkins centos, install jenkins redhat
Stay connected with us on social networking sites, Thank you.
YouTube | Facebook | Twitter | Pinterest | Rss
install jenkins rhel 7, download jenkins, how to download jenkins, download jenkins war, jenkins tutorial, jenkins users, jenkins install linux, jenkins install centos, jenkins install redhat, step by step jenkins install
May 02, 2018

Post a Comment

[disqus][facebook][blogger]

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget