这里以Ubuntu为例,其它的也是类似的,同志们可以举一反三。
因为需要有JDK的环境,所以JDK环境安装参见:https://www.cnblogs.com/cnroadbridge/p/15221231.html
安装完以后我们去下载最新的war包, 地址如下: http://mirrors.jenkins.io/war-stable/latest/jenkins.war
创建Jenkins的安装目录 sudo mkdir -p /opt/jenkins
进入这个目录 cd /opt/jenkins
将前面下载的war包拷贝到楼上这个目录,或者直接点,执行这个命令 wget -O /opt/jenkins/jenkins.war http://mirrors.jenkins.io/war-stable/latest/jenkins.war
运行这个war包 java -jar jenkins.war --httpPort=8080
, 此时浏览器打开http://localhost:8080
即可访问
具体的日志如下:
ataola@ubuntu-ataola-3:/opt/jenkins$ java -jar jenkins.war --httpPort=8080
Running from: /opt/jenkins/jenkins.war
webroot: $user.home/.jenkins
2021-09-02 02:11:07.982+0000 [id=1] INFO org.eclipse.jetty.util.log.Log#initialized: Logging initialized @689ms to org.eclipse.jetty.util.log.JavaUtilLog
2021-09-02 02:11:08.294+0000 [id=1] INFO winstone.Logger#logInternal: Beginning extraction from war file
2021-09-02 02:11:10.334+0000 [id=1] WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2021-09-02 02:11:10.425+0000 [id=1] INFO org.eclipse.jetty.server.Server#doStart: jetty-9.4.42.v20210604; built: 2021-06-04T17:33:38.939Z; git: 5cd5e6d2375eeab146813b0de9f19eda6ab6e6cb; jvm 1.8.0_111-b14
2021-09-02 02:11:10.756+0000 [id=1] INFO o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2021-09-02 02:11:10.880+0000 [id=1] INFO o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0
2021-09-02 02:11:10.896+0000 [id=1] INFO o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults
2021-09-02 02:11:10.897+0000 [id=1] INFO o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 600000ms
2021-09-02 02:11:11.406+0000 [id=1] INFO hudson.WebAppMain#contextInitialized: Jenkins home directory: /home/ataola/.jenkins found at: $user.home/.jenkins
2021-09-02 02:11:11.626+0000 [id=1] INFO o.e.j.s.handler.ContextHandler#doStart: Started w.@40bffbca{Jenkins v2.303.1,/,file:///home/ataola/.jenkins/war/,AVAILABLE}{/home/ataola/.jenkins/war}
2021-09-02 02:11:11.661+0000 [id=1] INFO o.e.j.server.AbstractConnector#doStart: Started ServerConnector@1a4927d6{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2021-09-02 02:11:11.661+0000 [id=1] INFO org.eclipse.jetty.server.Server#doStart: Started @4368ms
2021-09-02 02:11:11.665+0000 [id=21] INFO winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
2021-09-02 02:11:13.038+0000 [id=28] INFO jenkins.InitReactorRunner$1#onAttained: Started initialization
2021-09-02 02:11:13.090+0000 [id=29] INFO jenkins.InitReactorRunner$1#onAttained: Listed all plugins
2021-09-02 02:11:15.273+0000 [id=26] INFO jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
2021-09-02 02:11:15.284+0000 [id=28] INFO jenkins.InitReactorRunner$1#onAttained: Started all plugins
2021-09-02 02:11:15.302+0000 [id=26] INFO jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
2021-09-02 02:11:16.601+0000 [id=29] INFO jenkins.InitReactorRunner$1#onAttained: System config loaded
2021-09-02 02:11:16.603+0000 [id=29] INFO jenkins.InitReactorRunner$1#onAttained: System config adapted
2021-09-02 02:11:16.603+0000 [id=27] INFO jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
2021-09-02 02:11:16.603+0000 [id=27] INFO jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
2021-09-02 02:11:16.946+0000 [id=41] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$0: Started Download metadata
2021-09-02 02:11:17.025+0000 [id=41] INFO hudson.util.Retrier#start: Attempt #1 to do the action check updates server
2021-09-02 02:11:17.559+0000 [id=29] 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:
1d66bd47b3fc41cc840062866bf82e2f
This may also be found at: /home/ataola/.jenkins/secrets/initialAdminPassword
*************************************************************
*************************************************************
*************************************************************
1d66bd47b3fc41cc840062866bf82e2f
这个就是我运行完这个war包,最开始生成的密码。