侧边栏壁纸
博主头像
MDZZW博主等级

曾经也是帅哥,如今只是肉多

  • 累计撰写 28 篇文章
  • 累计创建 26 个标签
  • 累计收到 7 条评论

Jenkins 安装配置

MDZZW
2021-05-17 / 0 评论 / 0 点赞 / 563 阅读 / 889 字
温馨提示:
本文最后更新于 2022-10-26,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

Linux centos 安装配置 Jenkins

  1. 安装JDK

    #1.查看安装包  ls
    [app@jenkins app]$ ls
    jdk-8u291-linux-x64.rpm
    
    #2.安装jdk rpm -ivh jdk-8u291-linux-x64.rpm
    [app@jenkins app]$ rpm -ivh jdk-8u291-linux-x64.rpm
    
    #出现错误当前账号没有权限    这里使用 sudo jdk rpm -ivh jdk-8u291-linux-x64.rpm
    warning: jdk-8u291-linux-x64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
    error: can t create transaction lock on /var/lib/rpm/.rpm.lock (Permission denied)
    
    #困难重重 找运维 去开 sudo权限....
    [app@jenkins app]$ sudo rpm -ivh jdk-8u291-linux-x64.rpm   
    [sudo] password for app: 
    app is not allowed to run sudo on jenkins.  This incident will be reported.
    
    # 权限开启成功安装成功
    [app@jenkins app]$ sudo rpm -ivh jdk-8u291-linux-x64.rpm 
    [sudo] password for app: 
    warning: jdk-8u291-linux-x64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:jdk1.8-2000:1.8.0_291-fcs        ################################# [100%]
    Unpacking JAR files...
            tools.jar...
            plugin.jar...
            javaws.jar...
            deploy.jar...
            rt.jar...
            jsse.jar...
            charsets.jar...
            localedata.jar...
    #3.测试jdk   java -version    安装成功
    [app@jenkins app]$ java -version
    java version "1.8.0_291"
    Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
    Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)
    
    #4. 设置环境变量 sudo vim /etc/profile   将下面的配置加入进去
    [app@jenkins ~]$ sudo vim /etc/profile
    export JAVA_HOME=/usr/java/jdk1.8.0_291-amd64
    export JRE_HOME=${JAVA_HOME}/jre
    export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
    export PATH=${JAVA_HOME}/bin:$PATH
    
    #5.保存刷新
    [app@jenkins ~]$ source /etc/profile
    
    #6.查看环境变量
    [app@jenkins ~]$ echo $JAVA_HOME
    /usr/java/jdk1.8.0_291-amd64
    
  2. 安装Jenkins

    #1.通过 wget 下载 Jenkins需要的组件,又发现没有weget...
    [app@jenkins app]$ sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins-ci.org/redhat/jenkins.repo
    sudo: wget: command not found
    
    #2.安装wget    sudo yum -y install wget
    # 出现Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    Resolving Dependencies
    --> Running transaction check
    ---> Package wget.x86_64 0:1.14-18.el7 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved    表示安装成功
    #3. 重新下载组件下载成功    sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins-ci.org/redhat/jenkins.repo
    [app@jenkins app]$ sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins-ci.org/redhat/jenkins.repo
    --2021-05-12 16:03:10--  https://pkg.jenkins-ci.org/redhat/jenkins.repo
    Resolving pkg.jenkins-ci.org (pkg.jenkins-ci.org)... 52.202.51.185
    Connecting to pkg.jenkins-ci.org (pkg.jenkins-ci.org)|52.202.51.185|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 71
    Saving to: ‘/etc/yum.repos.d/jenkins.repo’
    
    100%[=================================================================================================================================================>] 71          --.-K/s   in 0s      
    
    2021-05-12 16:03:11 (13.8 MB/s) - ‘/etc/yum.repos.d/jenkins.repo’ saved [71/71]
    
    #4.安装签名之类的东西
    sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
    #5. 安装 jenkins 出现对话 一直 y   
    #中途出现 jenkins-xxxx.noarch.rpm   FAILED  超时错误 ....哎呀脑壳痛
    sudo yum install jenkins
    
    #处理Public key for jenkins-2.292-1.1.noarch.rpm is not installed
    #6. 网上说执行
    sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
    #再执行
    [app@jenkins app]sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
    #更新下
    [app@jenkins app]$ sudo yum update
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    No packages marked for update
    #再次安装 决斗时刻   
    sudo yum install jenkins
    

    20210512_17453020.png![]

    启动服务试试 终于成功了…太折腾人了

    [app@jenkins app]$ sudo service jenkins restart
    Restarting jenkins (via systemctl):                        [  OK  ]
    

20210512_17460123.png

浏览器访问:ip:8080 太恶心人了…分析一波 应该是新服务器 没有开启8080端口或者是内网网段不同不能直接访问.

找运维又开端口…他可能都要打死我了

20210512_17461964.png

20210512_17463838.png

找网管劈里啪啦一顿操作…终于开启 输入IP:端口 终于成功了

20210512_17470753.png

  1. 配置Jenkins

    进入后台

    #1.查看密码
    [app@jenkins ~]$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
    

    自定义安装插件

    20210512_17472870.png

    20210512_17475667.png

    选择了一个中文包 创建一个用户

    20210512_1748101.png

0

评论区