CentOS 7.5 deploy the latest stable version of jenkins and configure ldap authentication

Reference document

https://wiki.jenkins.io/display/JENKINS/Installing+Jenkins+on+Red+Hat+distributions
https://wiki.jenkins.io/display/JENKINS/LDAP+Plugin

I. deployment of jenkins

1. Set jenkins home directory environment

[root@VM_8_24_centos ~]# yum -y install java
[root@VM_8_24_centos builds]# java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

2. Install jenkins

[root@VM_8_24_centos ~]# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
[root@VM_8_24_centos ~]# rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
[root@VM_8_24_centos ~]# yum -y install jenkins
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package jenkins.noarch 0:2.150.2-1.1 will be installed
--> Finished Dependency Resolution

Installed:
  jenkins.noarch 0:2.150.2-1.1                                                                                                       

Complete!

3. Modify the location of jenkins home directory
The default value is / var/lib/jenkins. After modification, start the service. If the service has been started before, the plug-in will be reinstalled and wait until the new directory

[root@VM_8_24_centos ~]# mkdir /data1/jenkins/
[root@VM_8_24_centos ~]# chown jenkins:jenkins /data1/jenkins/
[root@VM_8_24_centos ~]# source /etc/profile
[root@VM_8_24_centos ~]# echo $JENKINS_HOME
/data1/jenkins
[root@VM_8_24_centos ~]# grep JENKINS_HOME /etc/sysconfig/jenkins 
JENKINS_HOME="/data1/jenkins"
# permissions of $JENKINS_HOME and /var/log/jenkins.
# $JENKINS_HOME location. Do not enable this, "true", unless

4. Start jenkins service

[root@VM_8_24_centos ~]# systemctl start jenkins
[root@VM_8_24_centos ~]# systemctl status jenkins
● jenkins.service - LSB: Jenkins Automation Server
   Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
   Active: active (running) since Thu 2019-01-17 10:54:27 CST; 6s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 14935 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS)
   Memory: 391.4M
   CGroup: /system.slice/jenkins.service
           └─14960 /usr/bin/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /...
[root@VM_8_24_centos ~]# cat /data1/jenkins/secrets/initialAdminPassword
96a4e031a951464690c093c918410793
[root@VM_8_24_centos ~]# ls /data1/jenkins/
config.xml                     jenkins.install.UpgradeWizard.state  nodeMonitors.xml  secret.key.not-so-secret  users
hudson.model.UpdateCenter.xml  jenkins.telemetry.Correlator.xml     nodes             secrets
identity.key.enc               jobs                                 plugins           updates
jenkins.CLI.xml                logs                                 secret.key        userContent

2. Initialize jenkins environment

1. Open IP port 8080 in browser and input password

Centos7.5jenkinsldap

2. Choose to install plug-ins

Centos7.5jenkinsldap
Centos7.5jenkinsldap

3. Create initial management account

Centos7.5jenkinsldap

4. Set the jenkins url default http://ip:8080

Centos7.5jenkinsldap

5. Start using jenkins

Centos7.5jenkinsldap

6. The jenkins console interface is mainly configured in system management

Centos7.5jenkinsldap

3. Configure ldap

1. System configuration - global security configuration - Security Realm - select LDAP advanced service configuration

Centos7.5jenkinsldap

2. Security realm authorization add user or group setting permission

Centos7.5jenkinsldap

3. Domain account login

Tags: Linux jenkins Java xml yum

Posted on Wed, 04 Dec 2019 00:00:20 -0500 by Stathy