• Jenkins--安装配置使用


    Jenkins是一个开源软件项目,是基于Java开发的一种持续集成工具,用于监控持续重复的工作,旨在提供一个开

    放易用的软件平台,使软件的持续集成变成可能。

    官网:jenkins.io

    官方安装文档:https://jenkins.io/doc/book/installing/

    一、Jenkins安装

    1.1、docker化安装jenkins

    1)下载镜像

    [root@jenkins ~]# docker pull jenkins/jenkins
    [root@jenkins ~]# docker images
    REPOSITORY                                       TAG                 IMAGE ID            CREATED             SIZE
    jenkins/jenkins                                  latest              57f9f0b056cc        3 days ago          567MB

    2)启动容器

    #创建jenkins工作目录
    [root@jenkins ~]# mkdir -p /var/jenkins_home
    [root@jenkins ~]# chown -R 1000 /var/jenkins_home
    
    #启动容器
    [root@jenkins ~]# docker run -d -p 8080:8080 -p 50000:50000 -v /var/jenkins_home:/var/jenkins_home -v /etc/localtime:/etc/localtime --name jenkins jenkins/jenkins
    [root@jenkins ~]# docker ps -a
    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                 PORTS                                                           NAMES
    e77fd29db990        jenkins/jenkins     "/sbin/tini -- /usr/…"   10 seconds ago      Up 8 seconds           0.0.0.0:8080->8080/tcp, 0.0.0.0:50000->50000/tcp                jenkins
    3694c2292ed0        gitlab/gitlab-ce    "/assets/wrapper"        43 hours ago        Up 2 hours (healthy)   0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:222->22/tcp   gitlab

    3)在浏览器输入http://ip:8080进入Jenkins登录页面。页面会提示你到服务器的指定位置获取初始化密码

    [root@jenkins ~]# cat /var/jenkins_home/secrets/initialAdminPassword
    0aa1d04474dd4d2fb07b1d9e4136e498

    image

    安装推荐的插件:插件安装时间较长,可能有的插件安装不成功,多试几次即可(也可以后续再安装)

    image

    image

    创建管理员用户:

    image

    image

    image

    image

    4)配置常用工具—jdk

    image

    image

    1.2、进程式安装jenkins

    1)安装jdk

    [root@jenkins app]# rpm -ivh jdk-8u162-linux-x64.rpm
    [root@jenkins app]# java -version
    java version "1.8.0_162"
    Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
    Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)

    2)下载并安装jenkins rpm软件包

    [root@jenkins app]# wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat/jenkins-2.210-1.1.noarch.rpm
    [root@jenkins app]# rpm -ivh jenkins-2.210-1.1.noarch.rpm
    [root@jenkins app]# rpm -ql jenkins
    /etc/init.d/jenkins
    /etc/logrotate.d/jenkins
    /etc/sysconfig/jenkins
    /usr/lib/jenkins #jenkins安装目录
    /usr/lib/jenkins/jenkins.war
    /usr/sbin/rcjenkins
    /var/cache/jenkins
    /var/lib/jenkins  #默认的JENKINS_HOME
    /var/log/jenkins  #日志文件

    3)修改jenkins的启动用户

    [root@jenkins app]# vim /etc/sysconfig/jenkins
    JENKINS_USER="root"

    4)启动jenkins并访问http://ip:8080/

    [root@jenkins app]# systemctl start jenkins
    [root@jenkins app]# systemctl enable jenkins

    5)解锁jenkins

    image

    6)安装推荐插件

    image

    image

    7)创建管理员账户

    image

    image

    image

    二、jenkins使用

    2.1、创建自由风格项目

    image

    image

    image

    image

    image

    保存构建即可,第一次会从maven中央仓库下载依赖,时间较长,多试几次

  • 相关阅读:
    (树的直径)第九届湘潭市大学生程序设计比赛 H-Highway
    (记忆化DFS)Codeforces Round #413 D-Field expansion
    (树状数组)Codeforces Round #413 C-Fountains
    (几何)LeetCode Weekly Contest 32 D-Erect the Fence
    LeetCode Weekly Contest 32 解题报告
    (贪心)华师大程序设计竞赛 F-丽娃河的狼人传说
    (最短路)AtCoder Beginner Contest 061 D
    Tinkoff Challenge
    Codeforces Round #410 (Div. 2) 解题报告
    (二叉树)UVA
  • 原文地址:https://www.cnblogs.com/hujinzhong/p/12200241.html
Copyright © 2020-2023  润新知