一、安装

进入 Jenkins官网,选择下载war,或者mac可以使用命令 brew install jenkins
任一选择一个版本

在这里插入图片描述

二、启动Jenkins服务

默认8080端口很大概率被占用,所以我直接配置了端口
// war包启动方式
java -jar jenkins.war —-httpPort=1100

// homebrew启动方式
brew services start jenkins —-httpPort=1100
若出现以下日志,是端口被占用的情况:
hudson.WebAppMain#contextDestroyed: Shutting down a Jenkins instance that was still starting up
Caused by: java.net.BindException: Address already in use
Caused: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8080
Caused: java.io.IOException: Failed to start Jetty
若出现以下日志,则启动成功:
xxx@MacBook-Pro desktop % java -jar jenkins.war --httpPort=1100
Running from: /Users/xxx/Desktop/jenkins.war
webroot: $user.home/.jenkins
2022-07-12 03:10:14.617+0000 [id=1]	INFO	org.eclipse.jetty.util.log.Log#initialized: Logging initialized @1091ms to org.eclipse.jetty.util.log.JavaUtilLog
2022-07-12 03:10:14.738+0000 [id=1]	INFO	winstone.Logger#logInternal: Beginning extraction from war file
2022-07-12 03:10:14.778+0000 [id=1]	WARNING	o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2022-07-12 03:10:14.876+0000 [id=1]	INFO	org.eclipse.jetty.server.Server#doStart: jetty-9.4.45.v20220203; built: 2022-02-03T09:14:34.105Z; git: 4a0c91c0be53805e3fcffdcdcc9587d5301863db; jvm 11.0.11+9-LTS
2022-07-12 03:10:15.367+0000 [id=1]	INFO	o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
…
hudson.WebAppMain#contextInitialized: Jenkins home directory: /Users/xxx/.jenkins found at: $user.home/.jenkins
Warning: the fonts "Times" and "Times" are not available for the Java logical font "Serif", which may have unexpected appearance or behavior. Re-enable the "Times" font to remove this warning.
2022-07-12 03:10:16.975+0000 [id=1]	INFO	o.e.j.s.handler.ContextHandler#doStart: Started w.@4c432866{Jenkins v2.346.1,/,file:///Users/xxx/.jenkins/war/,AVAILABLE}{/Users/xxx/.jenkins/war}
2022-07-12 03:10:17.031+0000 [id=1]	INFO	o.e.j.server.AbstractConnector#doStart: Started
 …
jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
2022-07-12 03:10:19.054+0000 [id=35]	INFO	jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
2022-07-12 03:10:19.072+0000 [id=59]	INFO	hudson.model.AsyncPeriodicWork#lambda$doRun$1: Started Download metadata
2022-07-12 03:10:19.083+0000 [id=59]	INFO	hudson.util.Retrier#start: Attempt #1 to do the action check updates server
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/Users/xxx/.jenkins/war/WEB-INF/lib/groovy-all-2.4.21.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2022-07-12 03:10:19.550+0000 [id=41]	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:

// 初始密码
8a484e0fa02446ac89dfe1b75b3cd0e1

This may also be found at: /Users/xxx/.jenkins/secrets/initialAdminPassword

*************************************************************
*************************************************************
*************************************************************

三、配置Jenkins

进入配置页

启动完成后进入浏览器地址 http://localhost:1100/,密码在上面的启动成功后的日志中就有,复制填入,点击 继续
在这里插入图片描述

选择插件配置方式

我选择了推荐插件,也可以自定义选择插件
![在这里插入图片描述](https://img-blog.csdnimg.cn/d20c86af094d45889322bc73d2138b06.png

依赖自动配置中…

这个过程是自动的,需要几分钟时间
在这里插入图片描述

配置管理员账户

此步骤可以顺便修改初始密码
在这里插入图片描述

配置访问地址在这里插入图片描述


四、完成配置

点击保存并完成就配置好了

在这里插入图片描述

![在这里插入图片描述](https://img-blog.csdnimg.cn/2c6c94ce7f334c038776ea6870812f34.png

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐