• 【软件部署】Linux源码安装Jenkins


    1.确定java环境的安装(如果没有java环境需要配置java环境变量)
    java -version
    
    • 1

    在这里插入图片描述

    #编辑群居配置文件
    vim /etc/profile
    
    #在最下面,按i进入insert模式,添加一下内容
    JAVA_HOME=jdk路径
    export JAVA_HOME
    CLASSPATH=.:$JAVA_HOME/lib
    export CLASSPATH
    PATH=$PATH:$JAVA_HOME/bin:$CLASSPATH
    export PATH
    
    #重新加载配置
    source /etc/profile
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    2.获取Jenkins源文件
    cd /etc/yum.repos.d/
    wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
    
    • 1
    • 2
    3.导入Jenkins公钥
    rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
    
    • 1
    4.yum安装Jenkins
    yum install -y jenkins
    
    • 1
    5.Jenkins配置文件配置java环境
    vi /etc/init.d/jenkins
    
    • 1

    在这里插入图片描述

    6.配置文件
    /usr/lib/jenkins/ #jenkins安装目录,WAR包会放在这里。
     
    /etc/sysconfig/jenkins #jenkins配置文件
    
    /var/lib/jenkins/ #默认的JENKINS_HOME。 
    
    /var/log/jenkins/jenkins.log #日志文件
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    7.启停Jenkins
    service jenkins start
    service jenkins stop
    service jenkins restart
    
    • 1
    • 2
    • 3

    默认端口8080,ip:8080访问,注意虚拟机要开放端口,阿里云配置网络安全组

    8.jenkins无法安装插件问题
    • jenkins安装插件报错:原因是默认证书有问题
    sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
            at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:145)
            at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:131)
            at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
            at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382)
    Caused: sun.security.validator.ValidatorException: PKIX path building failed
            at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)
            at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
            at sun.security.validator.Validator.validate(Validator.java:260)
            at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
            at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
            at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
            at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1351)
    Caused: javax.net.ssl.SSLHandshakeException
            at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
            at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1917)
            at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:301)
            at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:295)
            at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1369)
            at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:156)
            at sun.security.ssl.Handshaker.processLoop(Handshaker.java:925)
            at sun.security.ssl.Handshaker.process_record(Handshaker.java:860)
            at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1043)
            at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1343)
            at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1371)
            at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1355)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 更新站点:https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

    在这里插入图片描述

    在这里插入图片描述
    在这里插入图片描述

    • 进入jenkins站点更新目录修改默认json配置
     cd /var/lib/jenkins/updates/
    
    • 1
    • 全局替换default.json里面的下载插件地址
    sed -i 's/http:\/\/updates.jenkins-ci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' default.json 
     
    sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' default.json
    
    • 1
    • 2
    • 3
    • 查找证书路径
    find / -type f -name cacerts
    
    • 1

    在这里插入图片描述

    • 修改jenkins配置文件
    vi /etc/sysconfig/jenkins
    
    JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Djavax.net.ssl.trustStore=/etc/pki/ca-trust/extracted/java/cacerts"
    
    • 1
    • 2
    • 3
    • 重启jenkins
    service restart jenkins 
    
    • 1
  • 相关阅读:
    CAD二次开发--CAD2007(.Net3.5环境)等低版本CAD二次开发在VS中无法捕获断点调试解决办法(CAD二次开发无法断点调试解决办法)
    子集和 DP - 模板详解
    求职刷题力扣DAY14 ---二叉树的基础遍历,迭代、递归
    java飞机航班信息查询系统演示视频2021计算机毕业设计MyBatis+系统+LW文档+源码+调试部署
    【控制台】 \xce\xde\xb7\xa8\xb4\xf2\xbf\xaa
    河南灌溉排涝设计丙级升乙级:人员配备结构与升级难点
    ROS话题(Topic)通信:自定义msg - 例程与讲解
    67. SAP ABAP 监控用户事物码和程序执行的工具介绍
    相关关系与因果关系
    牛客 day2 - 7
  • 原文地址:https://blog.csdn.net/weixin_47533244/article/details/127804283