在安装了CentOS 7.6的开发系统上,我试图通过yum安装jenkins,并以非root用户“ jenkins”的身份启动它。
创建用户“ jenkins”,将路径的/ var / lib / jenkins,/ var / cache / jenkins和/ var / log / jenkins所有者和组设置为“ jenkins”,并将变量“ JENKINS_USER”设置为“
/ etc / sysconfig / jenkins中的jenkins(如互联网上的各处所描述,例如fe http://blog.manula.org/2013/03/running-jenkins-under-different-user-in.html)。我的系统的特殊性:如此处https://wiki.jenkins.io/pages/viewpage.action?pageId=135468777所述,我在端口443上运行Jenkins,没有haproxy,apache等。我已经指出要生成一个jks存储并使用参数更改/ etc / sysconfig / jenkins文件。因此,我还将生成的自签名ssl证书的所有者和组设置为jenkins。
/ etc / sysconfig / jenkins:
JENKINS_HOME="/var/lib/jenkins"
JENKINS_ARGS="--httpPort=-1 --httpsPort=443 --httpsKeyStore=/var/lib/jenkins/jenkinsqit.fintechgroup.com.jks --httpsKeyStorePassword=jenkinsqit.fintechgroup.com"
JENKINS_JAVA_OPTIONS="-Xmx4096m -Dhudson.model.DownloadService.noSignatureCheck=true"
JENKINS_USER="jenkins"
/var/log/jenkins/jenkins.log条目
Running from: /usr/lib/jenkins/jenkins.war
2019-07-12 08:38:42.598+0000 [id=1] INFO org.eclipse.jetty.util.log.Log#initialized: Logging initialized @510ms to org.eclipse.jetty.util.log.JavaUtilLog
2019-07-12 08:38:42.664+0000 [id=1] INFO winstone.Logger#logInternal: Beginning extraction from war file
2019-07-12 08:38:43.894+0000 [id=1] WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2019-07-12 08:38:43.977+0000 [id=1] INFO winstone.Logger#logInternal: Exclude Ciphers [^.*_(MD5|SHA|SHA1)$, ^TLS_RSA_.*$, ^SSL_.*$, ^.*_NULL_.*$, ^.*_anon_.*$]
2019-07-12 08:38:43.999+0000 [id=1] INFO org.eclipse.jetty.server.Server#doStart: jetty-9.4.z-SNAPSHOT; built: 2019-05-02T00:04:53.875Z; git: e1bc35120a6617ee3df052294e433f3a25ce7097; jvm 1.8.0_212-b04
2019-07-12 08:38:44.307+0000 [id=1] INFO o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2019-07-12 08:38:44.360+0000 [id=1] INFO o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0
2019-07-12 08:38:44.360+0000 [id=1] INFO o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults
2019-07-12 08:38:44.362+0000 [id=1] INFO o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 600000ms
Jenkins home directory: /var/lib/jenkins found at: SystemProperties.getProperty("JENKINS_HOME")
2019-07-12 08:38:44.818+0000 [id=1] INFO o.e.j.s.handler.ContextHandler#doStart: Started w.@46ab18da{Jenkins v2.183,/,file:///var/cache/jenkins/war/,AVAILABLE}{/var/cache/jenkins/war}
2019-07-12 08:38:44.841+0000 [id=1] INFO o.e.j.server.AbstractConnector#doStop: Stopped ServerConnector@2f67a4d3{SSL,[ssl, http/1.1]}{0.0.0.0:443}
2019-07-12 08:38:44.848+0000 [id=1] INFO o.e.j.server.session.HouseKeeper#stopScavenging: node0 Stopped scavenging
2019-07-12 08:38:44.851+0000 [id=1] INFO hudson.WebAppMain#contextDestroyed: Shutting down a Jenkins instance that was still starting up
java.lang.Throwable: reason
at hudson.WebAppMain.contextDestroyed(WebAppMain.java:388)
at org.eclipse.jetty.server.handler.ContextHandler.callContextDestroyed(ContextHandler.java:965)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextDestroyed(ServletContextHandler.java:566)
at org.eclipse.jetty.server.handler.ContextHandler.stopContext(ContextHandler.java:942)
at org.eclipse.jetty.servlet.ServletContextHandler.stopContext(ServletContextHandler.java:376)
at org.eclipse.jetty.webapp.WebAppContext.stopWebapp(WebAppContext.java:1503)
at org.eclipse.jetty.webapp.WebAppContext.stopContext(WebAppContext.java:1467)
at org.eclipse.jetty.server.handler.ContextHandler.doStop(ContextHandler.java:1009)
at org.eclipse.jetty.servlet.ServletContextHandler.doStop(ServletContextHandler.java:288)
at org.eclipse.jetty.webapp.WebAppContext.doStop(WebAppContext.java:569)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at org.eclipse.jetty.util.component.ContainerLifeCycle.stop(ContainerLifeCycle.java:178)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:199)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:124)
at org.eclipse.jetty.server.Server.doStop(Server.java:464)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at winstone.Launcher.shutdown(Launcher.java:313)
at winstone.Launcher.<init>(Launcher.java:200)
at winstone.Launcher.main(Launcher.java:362)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at Main._main(Main.java:375)
at Main.main(Main.java:151)
2019-07-12 08:38:44.914+0000 [id=1] INFO o.e.j.s.handler.ContextHandler#doStop: Stopped w.@46ab18da{Jenkins v2.183,/,null,UNAVAILABLE}{/var/cache/jenkins/war}
Exception in thread "Jenkins initialization thread" java.lang.NoClassDefFoundError: hudson/util/HudsonFailedToLoad
at hudson.WebAppMain$3.run(WebAppMain.java:247)
Caused by: java.lang.ClassNotFoundException: hudson.util.HudsonFailedToLoad
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:555)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
2019-07-12 08:38:44.919+0000 [id=1] INFO winstone.Logger#logInternal: Jetty shutdown successfully
java.io.IOException: Failed to start Jetty
at winstone.Launcher.<init>(Launcher.java:189)
at winstone.Launcher.main(Launcher.java:362)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at Main._main(Main.java:375)
at Main.main(Main.java:151)
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:342)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:308)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:396)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at winstone.Launcher.<init>(Launcher.java:187)
... 7 more
2019-07-12 08:38:44.920+0000 [id=1] SEVERE winstone.Logger#logInternal: Container startup failed
java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:342)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:308)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:396)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at winstone.Launcher.<init>(Launcher.java:187)
Caused: java.io.IOException: Failed to start Jetty
at winstone.Launcher.<init>(Launcher.java:189)
at winstone.Launcher.main(Launcher.java:362)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at Main._main(Main.java:375)
at Main.main(Main.java:151)