Linux(Ubuntu16.04)下安裝Jenkins
jenkins官網https://pkg.jenkins.io
這是Jenkins的Debian軟體包存儲庫,用于自動安裝和更新。要使用此存儲庫,請先将密鑰添加到系統中:
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
然後追加下列内容到 /etc/apt/sources.list檔案中(apt指令下載下傳時會找下面的位址)
deb https://pkg.jenkins.io/debian-stable binary /
即: sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary / >> /etc/apt/sources.list'
更新您的本地包索引,然後最後安裝Jenkins:
sudo apt-get update
sudo apt-get install jenkins
安裝jenkins後
sudo /etc/init.d/jenkins start //jenkins服務開啟 注意端口号是否被占用(8080)
sudo /etc/init.d/jenkins status //檢視jenkins服務開啟狀态
sudo /etc/init.d/jenkins stop //jenkins服務關閉
檢視程序中的jenkins
ps aux | grep jenkins
jenkins的日志(/var/log/jenkins/jenkins.log)
more /var/log/jenkins/jenkins.log
啟動jenkins 若端口被占用時,需要關閉jenkins服務,更改被占用的端口(一般是改tomcat的)
再開啟jenkins服務,檢視下日志是否啟動成功!
7.進入選擇插件安裝界面,選擇第一個(Install suggested plugins)
8.插件安裝完成之後,需要建立第一個使用者
9.建立使用者之後,就可以使用jenkins了
附:Tomcat下部署Jenkins (win7)
官網下載下傳http://jenkins-ci.org/
直接下載下傳jenkins.war,網上說放到tomcat的webapps下,直接啟動tomcat便可,但是通路
http://localhost:8080/jenkins 出現了以下問題,且出現類似于下面的截圖(網上的圖),jenkins啟動失敗!
注:我使用的是apache-tomcat-7.0.75,jekins是2.56版本,jdk是1.8.0_131
四月 25, 2017 10:25:01 下午 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class jenkins.util.SystemProperties
java.lang.UnsupportedClassVersionError: jenkins/util/SystemProperties : Unsupported major.minor version 52.0 (unable to load class jenkins.util.SystemProperties)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3209)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:504)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:486)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:113)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5034)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1092)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1984)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
四月 25, 2017 10:25:01 下午 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class hudson.WebAppMain
java.lang.UnsupportedClassVersionError: hudson/WebAppMain : Unsupported major.minor version 52.0 (unable to load class hudson.WebAppMain)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3209)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:504)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:486)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:113)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5034)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1092)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1984)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
四月 25, 2017 10:25:01 下午 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class jenkins.JenkinsHttpSessionListener
java.lang.UnsupportedClassVersionError: jenkins/JenkinsHttpSessionListener : Unsupported major.minor version 52.0 (unable to load class jenkins.JenkinsHttpSessionListener)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3209)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:504)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:486)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:113)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5034)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1092)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1984)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
四月 25, 2017 10:25:01 下午 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)
四月 25, 2017 10:25:01 下午 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
四月 25, 2017 10:25:01 下午 org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
四月 25, 2017 10:25:01 下午 org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', '[email protected]')
四月 25, 2017 10:30:27 下午 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class jenkins.util.SystemProperties
java.lang.UnsupportedClassVersionError: jenkins/util/SystemProperties : Unsupported major.minor version 52.0 (unable to load class jenkins.util.SystemProperties)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3209)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:504)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:486)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:113)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5034)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1092)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1984)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
四月 25, 2017 10:30:27 下午 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class hudson.WebAppMain
java.lang.UnsupportedClassVersionError: hudson/WebAppMain : Unsupported major.minor version 52.0 (unable to load class hudson.WebAppMain)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3209)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:504)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:486)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:113)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5034)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5634)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1092)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1984)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
四月 25, 2017 10:30:27 下午 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class jenkins.JenkinsHttpSessionListener
java.lang.UnsupportedClassVersionError: jenkins/JenkinsHttpSessionListener : Unsupported major.minor version 52.0 (unable to load class jenkins.JenkinsHttpSessionListener)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3209)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:504)
at o
網上找了些部落格資料如下:
http://www.mkyong.com/java/java-unsupported-major-minor-version-51-0/ 大概說的是major.minor version 52.0 = JDK 1.8 / 8 (可我系統java就是1.8)
結果網上說可以用:java -jar jenkins.war 啟動方式,最終啟動了
D:\Tools>java -jar jenkins.war
Running from: D:\Tools\jenkins.war
webroot: $user.home/.jenkins
[33m四月 26, 2017 8:28:16 下午 Main deleteWinstoneTempContents
警告: Failed to delete the temporary Winstone file C:\Users\ADMINI~1\AppData\Local\Temp\winstone\jenkins.war
[0m四月 26, 2017 8:28:16 下午 org.eclipse.jetty.util.log.JavaUtilLog info
資訊: Logging initialized @999ms
四月 26, 2017 8:28:16 下午 winstone.Logger logInternal
資訊: Beginning extraction from war file
[33m四月 26, 2017 8:28:16 下午 org.eclipse.jetty.util.log.JavaUtilLog warn
警告: Empty contextPath
[0m四月 26, 2017 8:28:16 下午 org.eclipse.jetty.util.log.JavaUtilLog info
資訊: jetty-9.2.z-SNAPSHOT
四月 26, 2017 8:28:18 下午 org.eclipse.jetty.util.log.JavaUtilLog info
資訊: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
Jenkins home directory: C:\Users\Administrator\.jenkins found at: $user.home/.jenkins
四月 26, 2017 8:28:19 下午 org.eclipse.jetty.util.log.JavaUtilLog info
資訊: Started [email protected]{/,file:/C:/Users/Administrator/.jenkins/war/,AVAILABLE}{C:\Users\Administrator\.jenkins\war}
四月 26, 2017 8:28:19 下午 org.eclipse.jetty.util.log.JavaUtilLog info
資訊: Started [email protected]{HTTP/1.1}{0.0.0.0:8080}
四月 26, 2017 8:28:19 下午 org.eclipse.jetty.util.log.JavaUtilLog info
資訊: Started @3399ms
四月 26, 2017 8:28:19 下午 winstone.Logger logInternal
資訊: Winstone Servlet Engine v2.0 running: controlPort=disabled
四月 26, 2017 8:28:19 下午 jenkins.InitReactorRunner$1 onAttained
資訊: Started initialization
四月 26, 2017 8:28:19 下午 jenkins.InitReactorRunner$1 onAttained
資訊: Listed all plugins
四月 26, 2017 8:28:21 下午 jenkins.InitReactorRunner$1 onAttained
資訊: Prepared all plugins
四月 26, 2017 8:28:21 下午 jenkins.InitReactorRunner$1 onAttained
資訊: Started all plugins
四月 26, 2017 8:28:21 下午 jenkins.InitReactorRunner$1 onAttained
資訊: Augmented all extensions
四月 26, 2017 8:28:22 下午 jenkins.InitReactorRunner$1 onAttained
資訊: Loaded all jobs
四月 26, 2017 8:28:22 下午 hudson.model.AsyncPeriodicWork$1 run
資訊: Started Download metadata
四月 26, 2017 8:28:22 下午 hudson.model.AsyncPeriodicWork$1 run
資訊: Finished Download metadata. 8 ms
四月 26, 2017 8:28:22 下午 jenkins.InitReactorRunner$1 onAttained
資訊: Completed initialization
四月 26, 2017 8:28:23 下午 org.springframework.context.support.AbstractApplicationContext prepareRefresh
資訊: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@2a57a20c: display name [Root WebApplicationContext]; startup date [Wed Apr 26
20:28:23 CST 2017]; root of context hierarchy
四月 26, 2017 8:28:23 下午 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
資訊: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@2a57a20c]: org.springframework.beans.factory.suppor
[email protected]
四月 26, 2017 8:28:23 下午 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
資訊: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@24edf948: defining beans [authenticationManager]; root o
f factory hierarchy
四月 26, 2017 8:28:23 下午 org.springframework.context.support.AbstractApplicationContext prepareRefresh
資訊: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@a435e2d: display name [Root WebApplicationContext]; startup date [Wed Apr 26 2
0:28:23 CST 2017]; root of context hierarchy
四月 26, 2017 8:28:23 下午 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
資訊: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@a435e2d]: org.springframework.beans.factory.support
[email protected]
四月 26, 2017 8:28:23 下午 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
資訊: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@d091d78: defining beans [filter,legacy]; root of factory
hierarchy
四月 26, 2017 8:28:23 下午 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:
8c04dcc0e6f74b99a4bb60034af35fbb
This may also be found at: C:\Users\Administrator\.jenkins\secrets\initialAdminPassword
*************************************************************
*************************************************************
*************************************************************
四月 26, 2017 8:28:29 下午 hudson.model.UpdateSite updateData
資訊: Obtained the latest update center data file for UpdateSource default
四月 26, 2017 8:28:29 下午 hudson.WebAppMain$3 run
資訊: Jenkins is fully up and running
直接通路http://localhost:8080/jenkins 又報了錯
HTTP ERROR 404
Problem accessing /jenkins. Reason:
Not Found
Powered by Jetty://
結果搜尋後發現各種說法,還是沒解決!
然後通過直接通路http://localhost:8080/居然出現了jenkins的配置頁面,結果跳過安裝插件等配置頁面自動跳轉到了首頁
Win7上這也算是稀裡糊塗的部署啟動完畢...-_-||