首先我是从https://pkg.jenkins.io/redhat/镜像仓库中
使用wget命令下载的这个jenkins
ttps://pkg.jenkins.io/redhat/jenkins-2.150-1.1.noarch.rpm下载到/usr/jenkins文件夹下
wget https://pkg.jenkins.io/redhat/jenkins-2.150-1.1.noarch.rpm
安装使用的时候cd到下载目录使用命令安装
yum localinstall jenkins-2.150-1.1.noarch.rpm -y
安装完成之后想把jenkins设为开机启动
[root@localhost jenkins]# systemctl enable jenkins
jenkins.service is not a native service, redirecting to /sbin/chkconfig.
看来还是有问题。
使用service start jenkins.service不行
[root@localhost jenkins]# service start jenkins.service
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
使用systemctl start jenkins不行。
[root@localhost jenkins]# systemctl start jenkins.service
Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
看来我装的jenkins问题不小,于是各种网上搜索,看到有人说直接启动jenkins的war包,我试了一下
[root@localhost webapps]# java -jar jenkins.war
Running from: /usr/tomcat/apache-tomcat-8.5.38/webapps/jenkins.war
webroot: $user.home/.jenkins
二月 21, 2019 9:51:40 上午 org.eclipse.jetty.util.log.Log initialized
信息: Logging initialized @541ms to org.eclipse.jetty.util.log.JavaUtilLog
二月 21, 2019 9:51:40 上午 winstone.Logger logInternal
信息: Beginning extraction from war file
二月 21, 2019 9:51:40 上午 org.eclipse.jetty.server.handler.ContextHandler setContextPath
警告: Empty contextPath
二月 21, 2019 9:51:40 上午 org.eclipse.jetty.server.Server doStart
信息: jetty-9.4.z-SNAPSHOT; built: 2018-08-30T13:59:14.071Z; git: 27208684755d94a92186989f695db2d7b21ebc51; jvm 1.8.0_201-b09
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.webapp.StandardDescriptorProcessor visitServlet
信息: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.server.session.DefaultSessionIdManager doStart
信息: DefaultSessionIdManager workerName=node0
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.server.session.DefaultSessionIdManager doStart
信息: No SessionScavenger set, using defaults
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.server.session.HouseKeeper startScavenging
信息: node0 Scavenging every 660000ms
Jenkins home directory: /root/.jenkins found at: $user.home/.jenkins
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.server.handler.ContextHandler doStart
信息: Started w.@169bb4dd{Jenkins v2.164,/,file:///root/.jenkins/war/,AVAILABLE}{/root/.jenkins/war}
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.server.AbstractConnector doStop
信息: Stopped ServerConnector@1df8da7a{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.server.session.HouseKeeper stopScavenging
信息: node0 Stopped scavenging
二月 21, 2019 9:51:41 上午 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:960)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextDestroyed(ServletContextHandler.java:571)
at org.eclipse.jetty.server.handler.ContextHandler.stopContext(ContextHandler.java:937)
at org.eclipse.jetty.servlet.ServletContextHandler.stopContext(ServletContextHandler.java:381)
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:1004)
at org.eclipse.jetty.servlet.ServletContextHandler.doStop(ServletContextHandler.java:297)
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:149)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:170)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:124)
at org.eclipse.jetty.server.Server.doStop(Server.java:462)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at winstone.Launcher.shutdown(Launcher.java:310)
at winstone.Launcher.<init>(Launcher.java:197)
at winstone.Launcher.main(Launcher.java:354)
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)
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.server.handler.ContextHandler doStop
信息: Stopped w.@169bb4dd{Jenkins v2.164,/,null,UNAVAILABLE}{/root/.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:565)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
二月 21, 2019 9:51:41 上午 winstone.Logger logInternal
信息: Jetty shutdown successfully
java.io.IOException: Failed to start Jetty
at winstone.Launcher.<init>(Launcher.java:186)
at winstone.Launcher.main(Launcher.java:354)
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.BindException: 地址已在使用
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:339)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:307)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:235)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:395)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at winstone.Launcher.<init>(Launcher.java:184)
... 7 more
二月 21, 2019 9:51:41 上午 winstone.Logger logInternal
严重: Container startup failed
java.io.IOException: Failed to start Jetty
at winstone.Launcher.<init>(Launcher.java:186)
at winstone.Launcher.main(Launcher.java:354)
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.BindException: 地址已在使用
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:339)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:307)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:235)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:395)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at winstone.Launcher.<init>(Launcher.java:184)
... 7 more
地址被使用,我就去改jenkins的端口,搜索到这个博客https://blog.csdn.net/crazyboy12138/article/details/81046860
使用vi /etc/init.d/jenkins打开初始化jenkins的初始化文件
vi /etc/init.d/jenkins
使用vi /etc/sysconfig/jenkins找到jenkins的配置文件,
vi /etc/sysconfig/jenkins
通过控制台找到8080端口,我改成9999。
端口也改好了。再次用java -jar命令启动
[root@localhost webapps]# java -jar jenkins.war
Running from: /usr/tomcat/apache-tomcat-8.5.38/webapps/jenkins.war
webroot: $user.home/.jenkins
二月 21, 2019 9:51:40 上午 org.eclipse.jetty.util.log.Log initialized
信息: Logging initialized @541ms to org.eclipse.jetty.util.log.JavaUtilLog
二月 21, 2019 9:51:40 上午 winstone.Logger logInternal
信息: Beginning extraction from war file
二月 21, 2019 9:51:40 上午 org.eclipse.jetty.server.handler.ContextHandler setContextPath
警告: Empty contextPath
二月 21, 2019 9:51:40 上午 org.eclipse.jetty.server.Server doStart
信息: jetty-9.4.z-SNAPSHOT; built: 2018-08-30T13:59:14.071Z; git: 27208684755d94a92186989f695db2d7b21ebc51; jvm 1.8.0_201-b09
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.webapp.StandardDescriptorProcessor visitServlet
信息: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.server.session.DefaultSessionIdManager doStart
信息: DefaultSessionIdManager workerName=node0
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.server.session.DefaultSessionIdManager doStart
信息: No SessionScavenger set, using defaults
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.server.session.HouseKeeper startScavenging
信息: node0 Scavenging every 660000ms
Jenkins home directory: /root/.jenkins found at: $user.home/.jenkins
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.server.handler.ContextHandler doStart
信息: Started w.@169bb4dd{Jenkins v2.164,/,file:///root/.jenkins/war/,AVAILABLE}{/root/.jenkins/war}
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.server.AbstractConnector doStop
信息: Stopped ServerConnector@1df8da7a{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.server.session.HouseKeeper stopScavenging
信息: node0 Stopped scavenging
二月 21, 2019 9:51:41 上午 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:960)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextDestroyed(ServletContextHandler.java:571)
at org.eclipse.jetty.server.handler.ContextHandler.stopContext(ContextHandler.java:937)
at org.eclipse.jetty.servlet.ServletContextHandler.stopContext(ServletContextHandler.java:381)
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:1004)
at org.eclipse.jetty.servlet.ServletContextHandler.doStop(ServletContextHandler.java:297)
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:149)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStop(ContainerLifeCycle.java:170)
at org.eclipse.jetty.server.handler.AbstractHandler.doStop(AbstractHandler.java:124)
at org.eclipse.jetty.server.Server.doStop(Server.java:462)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
at winstone.Launcher.shutdown(Launcher.java:310)
at winstone.Launcher.<init>(Launcher.java:197)
at winstone.Launcher.main(Launcher.java:354)
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)
二月 21, 2019 9:51:41 上午 org.eclipse.jetty.server.handler.ContextHandler doStop
信息: Stopped w.@169bb4dd{Jenkins v2.164,/,null,UNAVAILABLE}{/root/.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:565)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
二月 21, 2019 9:51:41 上午 winstone.Logger logInternal
信息: Jetty shutdown successfully
java.io.IOException: Failed to start Jetty
at winstone.Launcher.<init>(Launcher.java:186)
at winstone.Launcher.main(Launcher.java:354)
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.BindException: 地址已在使用
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:339)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:307)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:235)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:395)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at winstone.Launcher.<init>(Launcher.java:184)
... 7 more
二月 21, 2019 9:51:41 上午 winstone.Logger logInternal
严重: Container startup failed
java.io.IOException: Failed to start Jetty
at winstone.Launcher.<init>(Launcher.java:186)
at winstone.Launcher.main(Launcher.java:354)
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.BindException: 地址已在使用
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:339)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:307)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:235)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:395)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at winstone.Launcher.<init>(Launcher.java:184)
... 7 more
还是报错,怎么还是报错?端口明明改了,难道是防火墙没有开放端口。
使用 firewall-ctl --zone=public --add-post=9999/tcp --permanent永久开放9999端口
firewall-ctl --zone=public --add-post=9999/tcp --permanent
再次使用java -jar命令命令启动,还是报错,崩溃。突然想起来昨天把gitlab环境搭好了,但是很多人说gitlab很占内存,难道我的4G内存也被占完了吗?于是使用free命令看了一下
[root@localhost webapps]# free -h
total used free shared buff/cache available
Mem: 3.5G 2.5G 235M 52M 763M 672M
Swap: 3.7G 7.0M 3.7G
果然,内存还剩235M,看来gitlab确实很占内存,还好是用自己的电脑搞得,回头再加内存吧。赶紧把gitlab服务停掉
[root@localhost webapps]# gitlab-ctl stop
ok: down: alertmanager: 0s, normally up
ok: down: gitaly: 0s, normally up
ok: down: gitlab-monitor: 0s, normally up
ok: down: gitlab-workhorse: 1s, normally up
ok: down: logrotate: 0s, normally up
ok: down: nginx: 1s, normally up
ok: down: node-exporter: 0s, normally up
ok: down: postgres-exporter: 0s, normally up
ok: down: postgresql: 0s, normally up
ok: down: prometheus: 0s, normally up
ok: down: redis: 1s, normally up
ok: down: redis-exporter: 0s, normally up
ok: down: sidekiq: 0s, normally up
ok: down: unicorn: 0s, normally up
[root@localhost webapps]# free -h
total used free shared buff/cache available
Mem: 3.5G 256M 2.6G 1.8M 718M 3.0G
Swap: 3.7G 7.0M 3.7G
再看一下内存内存,使用情况,看来还需要加个4G内存。
那就再启动一次试试吧,
[root@localhost webapps]# java -j jenkins.war
Unrecognized option: -j
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
[root@localhost webapps]# java -jar jenkins.war
Running from: /usr/tomcat/apache-tomcat-8.5.38/webapps/jenkins.war
webroot: $user.home/.jenkins
二月 21, 2019 9:56:09 上午 org.eclipse.jetty.util.log.Log initialized
信息: Logging initialized @500ms to org.eclipse.jetty.util.log.JavaUtilLog
二月 21, 2019 9:56:09 上午 winstone.Logger logInternal
信息: Beginning extraction from war file
二月 21, 2019 9:56:09 上午 org.eclipse.jetty.server.handler.ContextHandler setContextPath
警告: Empty contextPath
二月 21, 2019 9:56:09 上午 org.eclipse.jetty.server.Server doStart
信息: jetty-9.4.z-SNAPSHOT; built: 2018-08-30T13:59:14.071Z; git: 27208684755d94a92186989f695db2d7b21ebc51; jvm 1.8.0_201-b09
二月 21, 2019 9:56:09 上午 org.eclipse.jetty.webapp.StandardDescriptorProcessor visitServlet
信息: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
二月 21, 2019 9:56:09 上午 org.eclipse.jetty.server.session.DefaultSessionIdManager doStart
信息: DefaultSessionIdManager workerName=node0
二月 21, 2019 9:56:09 上午 org.eclipse.jetty.server.session.DefaultSessionIdManager doStart
信息: No SessionScavenger set, using defaults
二月 21, 2019 9:56:09 上午 org.eclipse.jetty.server.session.HouseKeeper startScavenging
信息: node0 Scavenging every 660000ms
Jenkins home directory: /root/.jenkins found at: $user.home/.jenkins
二月 21, 2019 9:56:10 上午 org.eclipse.jetty.server.handler.ContextHandler doStart
信息: Started w.@169bb4dd{Jenkins v2.164,/,file:///root/.jenkins/war/,AVAILABLE}{/root/.jenkins/war}
二月 21, 2019 9:56:10 上午 org.eclipse.jetty.server.AbstractConnector doStart
信息: Started ServerConnector@1c9b0314{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
二月 21, 2019 9:56:10 上午 org.eclipse.jetty.server.Server doStart
信息: Started @1635ms
二月 21, 2019 9:56:10 上午 winstone.Logger logInternal
信息: Winstone Servlet Engine v4.0 running: controlPort=disabled
二月 21, 2019 9:56:12 上午 jenkins.InitReactorRunner$1 onAttained
信息: Started initialization
二月 21, 2019 9:56:12 上午 jenkins.InitReactorRunner$1 onAttained
信息: Listed all plugins
二月 21, 2019 9:56:13 上午 jenkins.InitReactorRunner$1 onAttained
信息: Prepared all plugins
二月 21, 2019 9:56:13 上午 jenkins.InitReactorRunner$1 onAttained
信息: Started all plugins
二月 21, 2019 9:56:13 上午 jenkins.InitReactorRunner$1 onAttained
信息: Augmented all extensions
二月 21, 2019 9:56:14 上午 jenkins.InitReactorRunner$1 onAttained
信息: Loaded all jobs
二月 21, 2019 9:56:14 上午 hudson.model.AsyncPeriodicWork$1 run
信息: Started Download metadata
二月 21, 2019 9:56:15 上午 hudson.util.Retrier start
信息: Attempt #1 to do the action check updates server
二月 21, 2019 9:56:16 上午 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@6a485566: display name [Root WebApplicationContext]; startup date [Thu Feb 21 09:56:16 CST 2019]; root of context hierarchy
二月 21, 2019 9:56:16 上午 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
信息: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@6a485566]: org.springframework.beans.factory.support.DefaultListableBeanFactory@72cbf61b
二月 21, 2019 9:56:16 上午 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@72cbf61b: defining beans [authenticationManager]; root of factory hierarchy
二月 21, 2019 9:56:16 上午 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@3aae740b: display name [Root WebApplicationContext]; startup date [Thu Feb 21 09:56:16 CST 2019]; root of context hierarchy
二月 21, 2019 9:56:16 上午 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
信息: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@3aae740b]: org.springframework.beans.factory.support.DefaultListableBeanFactory@3d5fbbe4
二月 21, 2019 9:56:16 上午 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3d5fbbe4: defining beans [filter,legacy]; root of factory hierarchy
二月 21, 2019 9:56:17 上午 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:
028b98ccf7324b2fa4e299e32fa31356
This may also be found at: /root/.jenkins/secrets/initialAdminPassword
*************************************************************
*************************************************************
*************************************************************
二月 21, 2019 9:56:35 上午 hudson.util.Retrier start
信息: The attempt #1 to do the action check updates server failed with an allowed exception:
java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
at hudson.model.DownloadService.loadJSON(DownloadService.java:167)
at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:188)
at hudson.PluginManager.checkUpdatesServer(PluginManager.java:1748)
at hudson.util.Retrier.start(Retrier.java:62)
at hudson.PluginManager.doCheckUpdatesServer(PluginManager.java:1719)
at jenkins.model.DownloadSettings$DailyCheck.execute(DownloadSettings.java:130)
at hudson.model.AsyncPeriodicWork$1.run(AsyncPeriodicWork.java:101)
at java.lang.Thread.run(Thread.java:748)
二月 21, 2019 9:56:35 上午 hudson.util.Retrier start
信息: Calling the listener of the allowed exception 'connect timed out' at the attempt #1 to do the action check updates server
二月 21, 2019 9:56:35 上午 hudson.util.Retrier start
信息: Attempted the action check updates server for 1 time(s) with no success
二月 21, 2019 9:56:35 上午 hudson.PluginManager doCheckUpdatesServer
严重: Error checking update sites for 1 attempt(s). Last exception was: SocketTimeoutException: connect timed out
二月 21, 2019 9:56:35 上午 hudson.model.AsyncPeriodicWork$1 run
信息: Finished Download metadata. 20,750 ms
二月 21, 2019 9:56:37 上午 hudson.model.UpdateCenter updateDefaultSite
警告: Upgrading Jenkins. Failed to update the default Update Site 'default'. Plugin upgrades may fail.
java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
at hudson.model.DownloadService.loadJSON(DownloadService.java:167)
at hudson.model.UpdateSite.updateDirectlyNow(UpdateSite.java:188)
at hudson.model.UpdateCenter.updateDefaultSite(UpdateCenter.java:2364)
at jenkins.install.SetupWizard.init(SetupWizard.java:174)
at jenkins.install.InstallState$InitialSecuritySetup.initializeState(InstallState.java:166)
at jenkins.model.Jenkins.setInstallState(Jenkins.java:1067)
at jenkins.install.InstallUtil.proceedToNextStateFrom(InstallUtil.java:97)
at jenkins.install.InstallState$Unknown.initializeState(InstallState.java:84)
at jenkins.model.Jenkins$16.run(Jenkins.java:3242)
at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296)
at jenkins.model.Jenkins$5.runTask(Jenkins.java:1096)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
二月 21, 2019 9:56:37 上午 jenkins.InitReactorRunner$1 onAttained
信息: Completed initialization
二月 21, 2019 9:56:37 上午 hudson.WebAppMain$3 run
信息: Jenkins is fully up and running
启动起来了,但是网页访问需要用户名和密码,跟别人说的那种需要用hashcode来更改密码的怎么不一样?于是我就把jenkins卸载了重新安装。
按照别人说的使用chkconfig把jenkins添加到启动项。启动jenkins失败。
[root@localhost jenkins]# chkconfig jenkins on
[root@localhost jenkins]# service jenkins start
Starting jenkins (via systemctl): Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
[失败]
使用提示的systemctl命令查看jenkins的状态,使用journalctl -xe查看启动项,都提示 Starting Jenkins bash: /usr/bin/java: 没有那个文件或目录,有点懵。
[root@localhost jenkins]# systemctl start jenkins
Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
[root@localhost jenkins]# systemctl status jenkins.service
● jenkins.service - LSB: Jenkins Automation Server
Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since 四 2019-02-21 11:41:16 CST; 17s ago
Docs: man:systemd-sysv-generator(8)
Process: 9172 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE)
2月 21 11:41:16 localhost.localdomain systemd[1]: Starting LSB: Jenkins Automation Server...
2月 21 11:41:16 localhost.localdomain runuser[9177]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
2月 21 11:41:16 localhost.localdomain jenkins[9172]: Starting Jenkins bash: /usr/bin/java: 没有那个文件或目录
2月 21 11:41:16 localhost.localdomain runuser[9177]: pam_unix(runuser:session): session closed for user jenkins
2月 21 11:41:16 localhost.localdomain jenkins[9172]: [失败]
2月 21 11:41:16 localhost.localdomain systemd[1]: jenkins.service: control process exited, code=exited status=1
2月 21 11:41:16 localhost.localdomain systemd[1]: Failed to start LSB: Jenkins Automation Server.
2月 21 11:41:16 localhost.localdomain systemd[1]: Unit jenkins.service entered failed state.
2月 21 11:41:16 localhost.localdomain systemd[1]: jenkins.service failed.
[root@localhost jenkins]# journalctl -xe
2月 21 11:41:09 localhost.localdomain systemd[1]: Unit jenkins.service entered failed state.
2月 21 11:41:09 localhost.localdomain systemd[1]: jenkins.service failed.
2月 21 11:41:09 localhost.localdomain polkitd[3439]: Unregistered Authentication Agent for unix-process:9148:789516 (system bus name :1
2月 21 11:41:16 localhost.localdomain polkitd[3439]: Registered Authentication Agent for unix-process:9166:790231 (system bus name :1.6
2月 21 11:41:16 localhost.localdomain systemd[1]: Starting LSB: Jenkins Automation Server...
-- Subject: Unit jenkins.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit jenkins.service has begun starting up.
2月 21 11:41:16 localhost.localdomain runuser[9177]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
2月 21 11:41:16 localhost.localdomain jenkins[9172]: Starting Jenkins bash: /usr/bin/java: 没有那个文件或目录
2月 21 11:41:16 localhost.localdomain runuser[9177]: pam_unix(runuser:session): session closed for user jenkins
2月 21 11:41:16 localhost.localdomain jenkins[9172]: [失败]
2月 21 11:41:16 localhost.localdomain systemd[1]: jenkins.service: control process exited, code=exited status=1
2月 21 11:41:16 localhost.localdomain systemd[1]: Failed to start LSB: Jenkins Automation Server.
-- Subject: Unit jenkins.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit jenkins.service has failed.
--
-- The result is failed.
2月 21 11:41:16 localhost.localdomain systemd[1]: Unit jenkins.service entered failed state.
2月 21 11:41:16 localhost.localdomain systemd[1]: jenkins.service failed.
2月 21 11:41:16 localhost.localdomain polkitd[3439]: Unregistered Authentication Agent for unix-process:9166:790231 (system bus name :1
于是搜索关于jenkins服务启动失败的,看到别人说要在jenkins初始化文件中加上java的路径,也没说怎么加,于是就把java的路径加进去。使用whereis java 找到java的路径。
[root@localhost jenkins]# whereis java
java: /usr/java/jdk1.8.0_201/bin/java
在jenkins的初始化文件中最后追加上java的路径,结果还是不行。最后看到这个https://stackoverflow.com/questions/39621263/jenkins-fails-when-running-service-start-jenkins
重新就该java的路径,再启动
Starting jenkins (via systemctl): Warning: jenkins.service changed on disk. Run 'systemctl daemon-reload' to reload units.
[ 确定 ]
可以启动,但是提示运行systemctl daemon-reload重新加载单元。于是
[root@localhost jenkins]# systemctl daemon-reload
[root@localhost jenkins]# systemctl start jenkins
[root@localhost jenkins]# systemctl enable jenkins
终于jenkins可以访问了
提示让我修改密码,去[root@localhost jenkins]# vi /var/lib/jenkins/secrets/initialAdminPassword
[root@localhost jenkins]# vi /var/lib/jenkins/secrets/initialAdminPassword
把里面的内容复制到jenkins的页面,剩下的就是jenkins的配置了。