【Jenkins】windows安装步骤

server/2024/10/17 18:22:44/

【Jenkins】windows安装步骤

  • 官网
  • 使用WAR包方式运行
  • 浏览器访问Jenkins
  • windows-installer安装
  • 安装过程问题解决
    • This account either does not hava the privilege to logon as a service or the account was unable to be verified
  • 安装成功
  • 修改jenkins.xml
  • 启动jenkins
  • 访问jenkins
  • 安装插件
    • 离线安装插件
  • 常用插件
  • 常用Jenkins页面

官网

  • 官网: https://www.jenkins.io/
  • windows下载地址: https://www.jenkins.io/download/thank-you-downloading-windows-installer/
  • 通用包下载,点击Generic Java package (.war):
    • https://mirrors.tuna.tsinghua.edu.cn/jenkins/war-stable/2.387.1/jenkins.war
    • https://mirror.twds.com.tw/jenkins/war-stable/2.462.3/jenkins.war
  • Jenkins安装软硬件要求: https://www.jenkins.io/doc/book/installing/linux/#prerequisites
    • Java版本要求: https://www.jenkins.io/doc/book/platform-information/support-policy-java/
  • 官方用户指南: https://www.jenkins.io/doc/
  • jenkins.io如果官网访问不了,尝试修改DNS114.114.114.1148.8.8.8

WAR_14">使用WAR包方式运行

  • 新建一个安装目录,例如D:\ProgramFiles\Jenkins
  • jenkins.war复制到安装目录
  • 新建环境变量: JENKINS_HOME=D:\ProgramFiles\Jenkins
    在这里插入图片描述

    解压的war包默认是放在C盘的用户目录,通过JENKINS_HOME环境变量可以快捷指定解压的WAR包路径、插件路径、日志路径等

  • 查看帮助: java -jar jenkins.war --help
Microsoft Windows [版本 10.0.22631.4317]
(c) Microsoft Corporation。保留所有权利。D:\ProgramFiles\Jenkins>java -jar jenkins.war --help
Running from: D:\ProgramFiles\Jenkins\jenkins.war
webroot: D:\ProgramFiles\Jenkins\war
Jenkins Automation Server Engine 2.462.3
Usage: java -jar jenkins.war [--option=value] [--option=value]Options:--webroot                = folder where the WAR file is expanded into. Default is ${JENKINS_HOME}/war--pluginroot             = folder where the plugin archives are expanded into. Default is ${JENKINS_HOME}/plugins(NOTE: this option does not change the directory where the plugin archives are stored)--extractedFilesFolder   = folder where extracted files are to be located. Default is the temp folder--enable-future-java     = allows running with Java versions which are not fully supported--paramsFromStdIn        = Read parameters from standard input (stdin)--version                = Print version to standard output (stdout) and exit--javaHome               = Override the JAVA_HOME variable--config                 = load configuration properties from here. Default is ./winstone.properties--prefix                 = add this prefix to all URLs (eg http://localhost:8080/prefix/resource). Default is none--commonLibFolder        = folder for additional jar files. Default is ./lib--logfile                = redirect log messages to this file--logThrowingLineNo      = show the line no that logged the message (slow). Default is false--logThrowingThread      = show the thread that logged the message. Default is false--debug                  = set the level of Winstone debug msgs (1-9). Default is 5 (INFO level)--httpPort               = set the http listening port. -1 to disable, Default is 8080--httpListenAddress      = set the http listening address. Default is all interfaces--httpUnixDomainPath     = set the http unix domain path. Default is no path--httpKeepAliveTimeout   = how long idle HTTP keep-alive connections are kept around (in ms; default 30000)?--httpsPort              = set the https listening port. -1 to disable, Default is disabled--httpsListenAddress     = set the https listening address. Default is all interfaces--httpsKeepAliveTimeout  = how long idle HTTPS keep-alive connections are kept around (in ms; default 30000)?--httpsKeyStore          = the location of the SSL KeyStore file. Default is ./winstone.ks--httpsKeyStorePassword  = the password for the SSL KeyStore file. Default is null--httpsKeyManagerType    = the SSL KeyManagerFactory type (eg SunX509, IbmX509). Default is SunX509--httpsRedirectHttp      = redirect http requests to https (requires both --httpPort and --httpsPort)--http2Port              = set the http2 listening port. -1 to disable, Default is disabled--httpsSniHostCheck      = if the SNI Host name must match when there is an SNI certificate. Check disabled per default--httpsSniRequired       = if a SNI certificate is required. Disabled per default--http2ListenAddress     = set the http2 listening address. Default is all interfaces--httpsVerifyClient      = if the client needs a certificate. Can be true (clients always needs a certificate),optional or false.--excludeProtocols       = set protocol versions to exclude. (comma separated list, use blank quote " " to exclude none)(default is "SSL", "SSLv2", "SSLv2Hello", "SSLv3")--excludeCipherSuites    = set the ciphers to exclude (comma separated, use blank quote " " to exclude none) (default is// Exclude weak / insecure ciphers"^.*_(MD5|SHA|SHA1)$",// Exclude ciphers that don't support forward secrecy"^TLS_RSA_.*$",// The following exclusions are present to cleanup known bad cipher// suites that may be accidentally included via include patterns.// The default enabled cipher list in Java will not include these// (but they are available in the supported list)."^SSL_.*$","^.*_NULL_.*$","^.*_anon_.*$"--controlPort            = set the shutdown/control port. -1 to disable, Default disabled--compression            = set the compression scheme (gzip or none to disable compression). Default is gzip.--sessionTimeout         = set the http session timeout value in minutes. Default to what webapp specifies, and then to 60 minutes--sessionEviction        = set the session eviction timeout for idle sessions in seconds. Default value is 180. -1 never evict, 0 evict on exit--mimeTypes=ARG          = define additional MIME type mappings. ARG would be EXT=MIMETYPE:EXT=MIMETYPE:...(e.g., xls=application/vnd.ms-excel:wmf=application/x-msmetafile)--requestHeaderSize=N    = set the maximum size in bytes of the request header. Default is 8192.--responseHeaderSize=N    = set the maximum size in bytes of the response header. Default is 8192.--maxParamCount=N        = set the max number of parameters allowed in a form submission to protectagainst hash DoS attack (oCERT #2011-003). Default is 10000.--useJmx                 = Enable Jetty Jmx--qtpMaxThreadsCount     = max threads number when using Jetty Queued Thread Pool--jettyAcceptorsCount    = Jetty Acceptors number--jettySelectorsCount    = Jetty Selectors number--usage / --help         = show this messageSecurity options:--realmClassName               = Set the realm class to use for user authentication. Defaults to ArgumentsRealm class--argumentsRealm.passwd.<user> = Password for user <user>. Only valid for the ArgumentsRealm realm class--argumentsRealm.roles.<user>  = Roles for user <user> (comma separated). Only valid for the ArgumentsRealm realm class--fileRealm.configFile         = File containing users/passwds/roles. Only valid for the FileRealm realm classAccess logging:--accessLoggerClassName        = Set the access logger class to use for user authentication. Defaults to disabled--simpleAccessLogger.format    = The log format to use. Supports combined/common/resin/custom (SimpleAccessLogger only)--simpleAccessLogger.file      = The location pattern for the log file(SimpleAccessLogger only)
  • 指定端口启动Jenkins: java -jar jenkins.war --httpPort=8890
D:\ProgramFiles\Jenkins>java -jar jenkins.war --httpPort=8890
Running from: D:\ProgramFiles\Jenkins\jenkins.war
webroot: D:\ProgramFiles\Jenkins\war
2024-10-11 01:27:24.897+0000 [id=1]     INFO    winstone.Logger#logInternal: Beginning extraction from war file
2024-10-11 01:27:25.753+0000 [id=1]     WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2024-10-11 01:27:25.813+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: jetty-10.0.24; built: 2024-08-26T17:58:21.070Z; git: d5384207795da96fad32db8ea8d26b69955bcc03; jvm 21+35-2513
2024-10-11 01:27:32.225+0000 [id=1]     INFO    o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2024-10-11 01:27:32.276+0000 [id=1]     INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: Session workerName=node0
2024-10-11 01:27:33.699+0000 [id=1]     INFO    hudson.WebAppMain#contextInitialized: Jenkins home directory: D:\ProgramFiles\Jenkins found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
2024-10-11 01:27:34.326+0000 [id=1]     INFO    o.e.j.s.handler.ContextHandler#doStart: Started w.@7ea08277{Jenkins v2.462.3,/,file:///D:/ProgramFiles/Jenkins/war/,AVAILABLE}{D:\ProgramFiles\Jenkins\war}
2024-10-11 01:27:34.451+0000 [id=1]     INFO    o.e.j.server.AbstractConnector#doStart: Started ServerConnector@2e48362c{HTTP/1.1, (http/1.1)}{0.0.0.0:8890}
2024-10-11 01:27:34.796+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: Started Server@14fc1f0{STARTING}[10.0.24,sto=0] @10278ms
2024-10-11 01:27:34.796+0000 [id=69]    INFO    winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
2024-10-11 01:27:34.952+0000 [id=78]    INFO    jenkins.InitReactorRunner$1#onAttained: Started initialization
2024-10-11 01:27:34.999+0000 [id=98]    INFO    jenkins.InitReactorRunner$1#onAttained: Listed all plugins
2024-10-11 01:27:37.490+0000 [id=106]   INFO    jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
2024-10-11 01:27:37.521+0000 [id=116]   INFO    jenkins.InitReactorRunner$1#onAttained: Started all plugins
2024-10-11 01:27:37.540+0000 [id=119]   INFO    jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
2024-10-11 01:27:38.148+0000 [id=119]   INFO    jenkins.InitReactorRunner$1#onAttained: System config loaded
2024-10-11 01:27:38.148+0000 [id=119]   INFO    jenkins.InitReactorRunner$1#onAttained: System config adapted
2024-10-11 01:27:38.148+0000 [id=92]    INFO    jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
2024-10-11 01:27:38.163+0000 [id=92]    INFO    jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
2024-10-11 01:27:38.226+0000 [id=136]   INFO    hudson.util.Retrier#start: Attempt #1 to do the action check updates server
2024-10-11 01:27:39.150+0000 [id=107]   INFO    jenkins.install.SetupWizard#init:*************************************************************
*************************************************************
*************************************************************Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:562cc0d6bc444f299ef44f79460f4589This may also be found at: D:\ProgramFiles\Jenkins\secrets\initialAdminPassword*************************************************************
*************************************************************
*************************************************************2024-10-11 01:27:47.879+0000 [id=136]   INFO    h.m.DownloadService$Downloadable#load: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller
2024-10-11 01:27:47.879+0000 [id=136]   INFO    hudson.util.Retrier#start: Performed the action check updates server successfully at the attempt #1
2024-10-11 01:27:51.060+0000 [id=107]   INFO    jenkins.InitReactorRunner$1#onAttained: Completed initialization
2024-10-11 01:27:51.060+0000 [id=58]    INFO    hudson.lifecycle.Lifecycle#onReady: Jenkins is fully up and running

Jenkins第一次启动,会在控制台打印管理员初始化密码,比如562cc0d6bc444f299ef44f79460f4589,同时jenkins目录下也生成了很多个文件夹
在这里插入图片描述

浏览器访问Jenkins

  • 访问http://localhost:8890
    在这里插入图片描述
  • 输入密码562cc0d6bc444f299ef44f79460f4589,进入jenkins首页

    如果忘记了或找不到启动时的初始密码,可以从这个位置查看初始密码: D:\ProgramFiles\Jenkins\secrets\initialAdminPassword

  • 选哪个都可以,我一般会选择选择插件来安装,可以看看默认勾选的是哪些插件
    在这里插入图片描述
  • 根据需要勾选插件,然后点右下角的安装
    在这里插入图片描述
  • 接下来就是等待Jenkins下载和安装上一步勾选的插件
    在这里插入图片描述
  • 安装完插件后,会进入下一个页面,创建管理员账号
    在这里插入图片描述

    也可以不创建用户,直接点击使用admin账户继续

  • 配置Jenkins访问地址

    在这里插入图片描述

  • 这样就完成了Jenkins的基本配置

    在这里插入图片描述

  • 成功进入Jenkins首页

    在这里插入图片描述

windowsinstaller_180">windows-installer安装

除了WAR包方式,windows还可以下载installer安装程序进行安装

安装过程问题解决

This account either does not hava the privilege to logon as a service or the account was unable to be verified

在这里插入图片描述

  • 如果出现这个错误提示,则参考资料: https://blog.csdn.net/wuxiaoying888/article/details/124457546
  • 命令行输入secpol.msc打开本地安全策略
  • 本地策略 --> 用户权限分配 --> 作为服务登录 --> 添加当前登录用户

安装成功

会在windows服务列表中新增一个Jenkins服务

jenkinsxml_193">修改jenkins.xml

  • <env name="JENKINS_HOME" value="D:\ProgramFiles\Jenkins\.jenkins"/>
  • <arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "D:\ProgramFiles\Jenkins\jenkins.war" --httpPort=8080 --webroot="D:\ProgramFiles\Jenkins\war"</arguments>
  • <pidfile>D:\ProgramFiles\Jenkins\jenkins.pid</pidfile>

jenkins_198">启动jenkins

net start Jenkins

jenkins_201">访问jenkins

  • 在浏览器输入http://localhost:8080
    在这里插入图片描述
  • 打开D:\ProgramFiles\Jenkins\.jenkins\secrets\initialAdminPassword复制初始化密码
  • 安装社区推荐的插件
    在这里插入图片描述
    • Folders
    • OWASP Markup Formatter
    • Build Timeout
    • Credentials Binding
    • Timestamper
    • Workspace Cleanup
    • Ant
    • Gradle
    • Pipeline
    • GitHub Branch Source
    • Pipeline: GitHub Groovy Libraries
    • Pipeline: Stage View
    • Git
    • SSH Build Agents
    • Matrix Authorization Strategy
    • PAM Authentication
    • LDAP
    • Email Extension
    • Mailer
    • Localization: Chinese (Simplified)
  • 跳过
    在这里插入图片描述

安装插件

离线安装插件

  • D:\ProgramFiles\Jenkins\.jenkins\plugins直接将jpi放入Jenkinsplugins文件夹下,然后重启Jenkins即可
  • 重启Jenkins,在浏览器输入http://localhost:8080/restart

常用插件

  • Git: https://plugins.jenkins.io/git/#releases
  • Subversion: https://plugins.jenkins.io/subversion/#releases
  • Gitee: https://plugins.jenkins.io/gitee/#releases
  • Pipeline: https://plugins.jenkins.io/workflow-aggregator/#releases
    Pipeline还依赖下面这几个插件
    • Pipeline: Stage View
    • Pipeline: Nodes and Processes
    • Pipeline: Basic Steps
  • Localization: Chinese (Simplified)
  • Publish Over SSH: https://plugins.jenkins.io/publish-over-ssh/#releases

常用Jenkins页面

  • Jenkins环境变量: http://localhost:8080/env-vars.html/
  • 全局变量: http://localhost:8080/job/ssh-test/pipeline-syntax/globals
  • Pipeline语法生成器: http://localhost:8080/job/ssh-test/pipeline-syntax/

http://www.ppmy.cn/server/131244.html

相关文章

C语言内存函数详解

文章目录 memcpy函数memmove函数memset函数memcmp函数 memcpy函数 void * memcpy ( void * destination, const void * source, size_t num );内存函数头文件是#include<string.h> 函数memcpy从source的位置开始向后复制num个字节的数据到destination指向的内存位置。 这…

npm 配置淘宝镜像

为了加速 npm 包的下载速度&#xff0c;尤其是在中国地区&#xff0c;配置淘宝的 npm 镜像&#xff08;也称为 cnpm 镜像&#xff09;是一个常见的方法。以下是如何配置淘宝 npm 镜像的步骤&#xff1a; 1. 使用 npm 命令配置镜像 你可以直接使用 npm 命令来设置淘宝的 npm 镜…

SwiftUI 在 iOS 18 中的 ForEach 点击手势逻辑发生改变的解决

概述 原本在 iOS 17 中运行良好的 SwiftUI 代码突然在 iOS 18 无法正常工作了&#xff0c;具体表现为原来视图中的的点击手势无法响应。 这是怎么回事呢&#xff1f; 且看分解&#xff01;Let’s go&#xff01;&#xff01;&#xff01;&#x1f609; 问题现象 从下面的演示…

深入Postman- 自动化篇

前言 在前两篇博文《Postman使用 - 基础篇》《玩转Postman:进阶篇》中,我们介绍了 Postman 作为一款专业接口测试工具在接口测试中的主要用法以及它强大的变量、脚本功能,给测试工作人员完成接口的手工测试带来了极大的便利。其实在自动化测试上,Postman 也能进行良好的支…

前端埋点学习

前端埋点 前端数据埋点是在前端页面中通过代码的方式手机用户行为数据和页面性能的过程&#xff0c;通过在页面中插入指定的代码&#xff0c;实现实时监控用户在页面上的操作行为。 通常包括一下事件 定义事件: 定义需要手机的数据事件&#xff0c;如点击&#xff0c;浏览等添…

c语言经典100例

1.字符串转为数字 #include <stdio.h>int strToInt(char *s) {int num0;int sign1;int step1;if (*s -){sign -1;s;}while (*s > 0&&*s < 9){num num*10(*s-0);step 10;s;}return num*sign; }int main() {char a[10] "-1234";char *s a ;pr…

PCL 平面点云边界特征提取(alpha shapes)

目录 一、概述 1.1原理 1.2实现步骤 1.3应用场景 二、代码实现 2.1关键函数 2.1.1 点云边界提取 2.1.2 可视化点云与边界 2.2完整代码 三、实现效果 PCL点云算法汇总及实战案例汇总的目录地址链接: PCL点云算法与项目实战案例汇总(长期更新) 一、概述 平…

树莓派应用--AI项目实战篇来啦-3.OpenCV 读取写入和显示图像

1. 介绍 在计算机视觉和图像处理领域&#xff0c;读取和显示图像是最基础且常见的操作之一&#xff0c;OpenCV作为一个强大的计算机视觉库&#xff0c;提供了丰富的功能来处理图像数据。 读取、显示和写入图像是图像处理和计算机视觉的基础&#xff0c;即使裁剪、调整大…