官网:
    https://jenkins.io/zh/download/

    Jenkins 中文社区
    https://jenkins-zh.cn/

    jdk环境部署:
    自动部署:
    https://github.com/liweiming0611/netFuture/edit/master/jenkins/jenkins/jdk8-maven32-git28.sh

    手动部署:
    下载:
    jdk-8u45-linux-x64.tar.gz
    apache-maven-3.5.3-bin.tar.gz

    tar xf jdk-8u45-linux-x64.tar.gz -C /usr/local
    ln -s /usr/local/jdk1.8.0_45/ /usr/local/jdk
    ln -s /usr/local/jdk/bin/java /usr/bin/java

    tar xf apache-maven-3.5.3-bin.tar.gz -C /usr/local
    mv /usr/local/apache-maven-3.5.3 maven-3.5.3
    ln -s /usr/local/maven-3.5.3/ /usr/local/maven

    systemctl start jenkins
    chkconfig —add jenkins
    systemctl status jenkins


    sudo tee /etc/profile <<-‘EOF’
    export JAVA_HOME=/usr/local/jdk
    export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    export PATH=$JAVA_HOME/bin:$PATH
    MAVEN_HOME=/usr/local/maven
    export MAVEN_HOME
    export PATH=${PATH}:${MAVEN_HOME}/bin
    EOF
    source /etc/profile

    mvn -v
    java -version

    Jenkins部署:

    rpm包安装:
    [root@riyimei ~]# wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.204.1-1.1.noarch.rpm

    [root@riyimei home]# rpm -ivh jenkins-2.204.1-1.1.noarch.rpm
    Preparing… ################################# [100%]
    Updating / installing…
    1:jenkins-2.204.1-1.1 ################################# [100%]
    [root@riyimei home]# rpm -q jenkins
    jenkins-2.204.1-1.1.noarch
    [root@riyimei home]# rpm -ql jenkins
    /etc/init.d/jenkins
    /etc/logrotate.d/jenkins
    /etc/sysconfig/jenkins
    /usr/lib/jenkins
    /usr/lib/jenkins/jenkins.war
    /usr/sbin/rcjenkins
    /var/cache/jenkins
    /var/lib/jenkins
    /var/log/jenkins
    [root@riyimei home]#

    yum安装:
    sudo tee /etc/yum.repos.d/jenkins.repo <<-‘EOF’
    [jenkins]
    name=Jenkins-stable
    baseurl=https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable
    gpgcheck=1
    EOF
    sudo rpm —import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
    yum install jenkins -y

    更新:
    https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/stable-2.89/update-center.json

    离线修改 vim /var/lib/jenkins/hudson.model.UpdateCenter.xml 改为:http
    [root@jenkins-master ~]# cat /var/lib/jenkins/hudson.model.UpdateCenter.xml
    <?xml version=’1.1’ encoding=’UTF-8’?>


    default
    https://updates.jenkins.io/update-center.json

    [root@riyimei ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
    3b8525f9324f47b19eed5c668c9290b8

    [root@jenkins-server ~]# cat /var/lib/jenkins/hudson.model.UpdateCenter.xml
    <?xml version=’1.1’ encoding=’UTF-8’?>


    default
    https://updates.jenkins.io/update-center.json

    [root@jenkins-server ~]# vim /var/lib/jenkins/hudson.model.UpdateCenter.xml

    web:
    http://192.168.31.83:8080/

    image.png

    image.png

    image.png

    image.png

    image.png

    image.png

    image.png

    更改插件源:

    image.png

    image.png

    image.png
    https://updates.jenkins.io/update-center.json 改为:

    https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

    image.png
    Jenkins中文社区:
    https://jenkins-zh.cn/wechat/articles/2019/11/2019-11-11-update-center-mirror-announcement/
    Jenkins (LTS) 部署 - 图12

    插件离线安装:
    https://plugins.jenkins.io/

    插件安装:

    Pipeline: Multibranch with defaults
    Pipeline

    Jenkins 版本更新 :
    yum 更新
    war包更新

    添加节点:

    image.png
    image.png

    image.png

    添加节点 没有通过 java web启动代理需要进入全局设置 —代理 —选择— 随机名称

    image.png

    image.png

    image.png

    启动脚本:

    [root@jenkins-salve01 jenkins]# cat start.sh
    #!/bin/bash
    nohup java -jar agent.jar -jnlpUrl http://192.168.31.83:8080/computer/salve01/slave-agent.jnlp -secret 3b7080fcdc628e4471ebb13ecc8badab41a6b142dc5f2ba517e3b03a6b953089 -workDir “/opt/Jenkins” &

    image.png

    image.png
    image.png

    启动开放的端口:8182

    [root@jenkins-salve01 jenkins]# cat nohup.out
    Jan 12, 2020 6:08:28 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
    INFO: Using /opt/Jenkins/remoting as a remoting work directory
    Jan 12, 2020 6:08:28 PM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
    INFO: Both error and output logs will be printed to /opt/Jenkins/remoting
    Jan 12, 2020 6:08:28 PM hudson.remoting.jnlp.Main createEngine
    INFO: Setting up agent: salve01
    Jan 12, 2020 6:08:28 PM hudson.remoting.jnlp.Main$CuiListener
    INFO: Jenkins agent is running in headless mode.
    Jan 12, 2020 6:08:28 PM hudson.remoting.Engine startEngine
    INFO: Using Remoting version: 3.36
    Jan 12, 2020 6:08:28 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
    INFO: Using /opt/Jenkins/remoting as a remoting work directory
    Jan 12, 2020 6:08:29 PM hudson.remoting.jnlp.Main$CuiListener status
    INFO: Locating server among [http://192.168.31.83:8080/]
    Jan 12, 2020 6:08:29 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
    INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
    Jan 12, 2020 6:08:29 PM hudson.remoting.jnlp.Main$CuiListener status
    INFO: Agent discovery successful
    Agent address: 192.168.31.83
    Agent port: 8182
    Identity: 8f:a5:c7:42:cf:62:d1:b8:4a:68:5b:50:5e:00:d7:3b
    Jan 12, 2020 6:08:29 PM hudson.remoting.jnlp.Main$CuiListener status
    INFO: Handshaking
    Jan 12, 2020 6:08:29 PM hudson.remoting.jnlp.Main$CuiListener status
    INFO: Connecting to 192.168.31.83:8182
    Jan 12, 2020 6:08:29 PM hudson.remoting.jnlp.Main$CuiListener status
    INFO: Trying protocol: JNLP4-connect
    Jan 12, 2020 6:08:29 PM hudson.remoting.jnlp.Main$CuiListener status
    INFO: Remote identity confirmed: 8f:a5:c7:42:cf:62:d1:b8:4a:68:5b:50:5e:00:d7:3b
    Jan 12, 2020 6:08:29 PM hudson.remoting.jnlp.Main$CuiListener status
    INFO: Connected
    [root@jenkins-salve01 jenkins]#

    Jenkins 用户和项目权限管理:

    image.png
    image.png

    image.png

    image.png

    image.png

    Jenkins 凭据管理:

    image.png

    image.png