Jenkins installation and basic environment

Jenkins

  • Installation method: yum and rpm
  • Service dependency: Java 8 or Java 11
  • Username: jenkins
  • Main directory: /var/lib/jenkins
  • Regular plugin installation

Official (yum)

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
yum install jenkins
#可能存在下载不了

rpm (Tsinghua mirror image)

wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.277.1-1.1.noarch.rpm

Download link: https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/

Start service

sudo systemctl start jenkins
sudo systemctl enable jenkins

Installation dependent environment

yum isntall java-1.8.0-openjdk-devel.x86_64 -y

The default web port of the view service is 8080, and the user name is jenkins
Insert picture description here

web operation

Mainly do not use the recommended installation for plug-ins, because it takes a long time and will fail, and it is not easy to learn the
Insert picture description here
Insert picture description here
main directory

/var/lib/jenkins

  • config.xml: the core configuration file of jenkins
  • jobs: configuration details of the build job, and build products and data
  • plugins: Store all installed plugins
  • users: When using jenkins local users
  • updates: Store available plug-in updates
  • userContent: store some content customized by the user for the jenkins server

Reference: https://blog.csdn.net/lijing742180/article/details/88544279

Regular plugin installation

  • File: /var/lib/jenkins/updates/default.json

Modify Jenkins plug-in download source (Tsinghua)

sudo sed -i 's/http:\/\/updates.jenkins-ci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' /var/lib/jenkins/updates/default.json \ 
&& sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' /var/lib/jenkins/updates/default.json

sudo systemctl restart jenkins
#重启后生效

Plug-in installations are all web operations, Plugin Manager
Insert picture description here

Support Chinese package

  • Plug-in name: Localization

User Management

  • The default built-in user management is too fine-grained, and it is not suitable for the general production environment
  • Plug-in name: Role-based Authorization Strategy
  • Modification strategy: System Management-Global Security Configuration-Authorization Strategy-Role-Based Strategy

One more configuration
Insert picture description here
role under system management

  • Global role: you can set and operate the jenkins system
  • Project role: The project role can only operate on the project
  • Node role: used by master-slave architecture

There will be detailed instructions for mouse clicks

Credential management

  • Plug-in name: Credentials Binding
  • Jenkins does not support credential management by default, so there is a security risk for Minggan information.
    Supports the basic and common credential method
    Insert picture description hereSSH management plug-in
  • Plug-in name: Publish Over SSH
  • User construction requires ssh connection information, in System Management-System Configuration-SSH Servers
    Insert picture description here
  • Plug-in name: SSH
  • Realize remote connection to the server to execute the shell
    Insert picture description here

Detailed tutorial video: https://www.bilibili.com/video/BV1kJ411p7mV?p=1

Guess you like

Origin blog.csdn.net/yangshihuz/article/details/114701075