jenkins自動化部署

  • 下載jenkins:https://jenkins.io/download/ 。下載的是jenkins.war。
  • Linux環境:Jdk1.8,Tomcat8。(查看JDK版本:java -version)。
  • 將下載的jenkins.war包放到Tomcat的webapps下而後啓動Tomcat,完成jenkins啓動。官方推薦使用:

  • 新建一個jenkins文件夾,將jenkins.war包放到這個新建的文件夾下面,在這個文件夾中使用:java -jar jenkins.war --httpPort=8080  命令啓動jenkins。
  • 啓動報錯:
    19-Sep-2019 14:25:08.044 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.43
    19-Sep-2019 14:25:08.051 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Mar 28 2017 14:42:59 UTC
    19-Sep-2019 14:25:08.051 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.43.0
    19-Sep-2019 14:25:08.051 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
    19-Sep-2019 14:25:08.051 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            5.2.15
    19-Sep-2019 14:25:08.051 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/java/jdk1.8.0_45/jre
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_45-b14
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /home/tomcat
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /home/tomcat
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/home/tomcat/conf/logging.properties
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
    19-Sep-2019 14:25:08.052 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
    19-Sep-2019 14:25:08.053 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/home/tomcat/endorsed
    19-Sep-2019 14:25:08.053 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/home/tomcat
    19-Sep-2019 14:25:08.053 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/home/tomcat
    19-Sep-2019 14:25:08.053 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/home/tomcat/temp
    19-Sep-2019 14:25:08.053 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
    19-Sep-2019 14:25:08.372 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
    19-Sep-2019 14:25:08.402 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
    19-Sep-2019 14:25:08.409 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
    19-Sep-2019 14:25:08.411 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
    19-Sep-2019 14:25:08.415 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1158 ms
    19-Sep-2019 14:25:08.471 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
    19-Sep-2019 14:25:08.474 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.43
    19-Sep-2019 14:25:08.509 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /home/tomcat/webapps/jenkins.war
    19-Sep-2019 14:25:25.480 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
    Jenkins home directory: /root/.jenkins found at: $user.home/.jenkins
    19-Sep-2019 14:25:26.376 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /home/tomcat/webapps/jenkins.war has finished in 17,858 ms
    19-Sep-2019 14:25:26.393 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
    19-Sep-2019 14:25:26.411 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
    19-Sep-2019 14:25:26.436 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 18021 ms
    19-Sep-2019 14:25:27.075 INFO [pool-6-thread-2] jenkins.InitReactorRunner$1.onAttained Started initialization
    19-Sep-2019 14:25:27.089 INFO [pool-6-thread-2] jenkins.InitReactorRunner$1.onAttained Listed all plugins
    19-Sep-2019 14:25:29.765 INFO [pool-6-thread-1] jenkins.InitReactorRunner$1.onAttained Prepared all plugins
    19-Sep-2019 14:25:29.766 INFO [pool-6-thread-1] jenkins.InitReactorRunner$1.onAttained Started all plugins
    19-Sep-2019 14:25:29.780 INFO [pool-6-thread-2] jenkins.InitReactorRunner$1.onAttained Augmented all extensions
    19-Sep-2019 14:25:29.818 WARNING [UpdateCenter.init] hudson.model.UpdateCenter.load Failed to load /root/.jenkins/hudson.model.UpdateCenter.xml
     java.io.IOException: Unable to read /root/.jenkins/hudson.model.UpdateCenter.xml
        at hudson.XmlFile.unmarshal(XmlFile.java:165)
        at hudson.model.UpdateCenter.load(UpdateCenter.java:775)
        at hudson.model.UpdateCenter.init(UpdateCenter.java:2035)
        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:497)
        at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
        at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:996)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: com.thoughtworks.xstream.io.StreamException:  : only 1.0 is supported as <?xml version not '1.1' (position: START_DOCUMENT seen <?xml version=\'1.1\'... @1:19) 
        at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:124)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
        at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:63)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:65)
        at hudson.XmlFile.unmarshal(XmlFile.java:163)
        ... 15 more
    Caused by: org.xmlpull.v1.XmlPullParserException: only 1.0 is supported as <?xml version not '1.1' (position: START_DOCUMENT seen <?xml version=\'1.1\'... @1:19) 
        at org.xmlpull.mxp1.MXParser.parseXmlDeclWithVersion(MXParser.java:2608)
        at org.xmlpull.mxp1.MXParser.parseXmlDecl(MXParser.java:2592)
        at org.xmlpull.mxp1.MXParser.parsePI(MXParser.java:2466)
        at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1447)
        at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
        at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
        at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
        ... 23 more
    
    19-Sep-2019 14:25:29.820 SEVERE [pool-6-thread-1] jenkins.InitReactorRunner$1.onTaskFailed Failed Loading global config
     java.io.IOException: Unable to read /root/.jenkins/config.xml
        at hudson.XmlFile.unmarshal(XmlFile.java:165)
        at jenkins.model.Jenkins.loadConfig(Jenkins.java:2783)
        at jenkins.model.Jenkins.access$700(Jenkins.java:321)
        at jenkins.model.Jenkins$16.run(Jenkins.java:2801)
        at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:996)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: com.thoughtworks.xstream.io.StreamException:  : only 1.0 is supported as <?xml version not '1.1' (position: START_DOCUMENT seen <?xml version=\'1.1\'... @1:19) 
        at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:124)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
        at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:63)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:65)
        at hudson.XmlFile.unmarshal(XmlFile.java:163)
        ... 11 more
    Caused by: org.xmlpull.v1.XmlPullParserException: only 1.0 is supported as <?xml version not '1.1' (position: START_DOCUMENT seen <?xml version=\'1.1\'... @1:19) 
        at org.xmlpull.mxp1.MXParser.parseXmlDeclWithVersion(MXParser.java:2608)
        at org.xmlpull.mxp1.MXParser.parseXmlDecl(MXParser.java:2592)
        at org.xmlpull.mxp1.MXParser.parsePI(MXParser.java:2466)
        at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1447)
        at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
        at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
        at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
        ... 19 more
    
    19-Sep-2019 14:25:29.845 SEVERE [Jenkins initialization thread] hudson.util.BootFailure.publish Failed to initialize Jenkins
     hudson.util.HudsonFailedToLoad: org.jvnet.hudson.reactor.ReactorException: java.io.IOException: Unable to read /root/.jenkins/config.xml
        at hudson.WebAppMain$3.run(WebAppMain.java:243)
    Caused by: org.jvnet.hudson.reactor.ReactorException: java.io.IOException: Unable to read /root/.jenkins/config.xml
        at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:269)
        at jenkins.InitReactorRunner.run(InitReactorRunner.java:44)
        at jenkins.model.Jenkins.executeReactor(Jenkins.java:1007)
        at jenkins.model.Jenkins.<init>(Jenkins.java:867)
        at hudson.model.Hudson.<init>(Hudson.java:85)
        at hudson.model.Hudson.<init>(Hudson.java:81)
        at hudson.WebAppMain$3.run(WebAppMain.java:226)
    Caused by: java.io.IOException: Unable to read /root/.jenkins/config.xml
        at hudson.XmlFile.unmarshal(XmlFile.java:165)
        at jenkins.model.Jenkins.loadConfig(Jenkins.java:2783)
        at jenkins.model.Jenkins.access$700(Jenkins.java:321)
        at jenkins.model.Jenkins$16.run(Jenkins.java:2801)
        at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:996)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: com.thoughtworks.xstream.io.StreamException:  : only 1.0 is supported as <?xml version not '1.1' (position: START_DOCUMENT seen <?xml version=\'1.1\'... @1:19) 
        at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:124)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:148)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:141)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:118)
        at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:103)
        at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:63)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:54)
        at com.thoughtworks.xstream.io.xml.AbstractXppDriver.createReader(AbstractXppDriver.java:65)
        at hudson.XmlFile.unmarshal(XmlFile.java:163)
        ... 11 more
    Caused by: org.xmlpull.v1.XmlPullParserException: only 1.0 is supported as <?xml version not '1.1' (position: START_DOCUMENT seen <?xml version=\'1.1\'... @1:19) 
        at org.xmlpull.mxp1.MXParser.parseXmlDeclWithVersion(MXParser.java:2608)
        at org.xmlpull.mxp1.MXParser.parseXmlDecl(MXParser.java:2592)
        at org.xmlpull.mxp1.MXParser.parsePI(MXParser.java:2466)
        at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1447)
        at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
        at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
        at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:109)
        ... 19 more
    
    19-Sep-2019 14:25:30.503 INFO [Jenkins initialization thread] jenkins.model.Jenkins.cleanUp Stopping Jenkins
    19-Sep-2019 14:25:30.922 WARNING [NullIdDescriptorMonitor.verify] hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.error Failed to instantiate Key[type=org.jenkinsci.main.modules.instance_identity.PageDecoratorImpl, annotation=[none]]; skipping this component
     com.google.inject.ProvisionException: Guice provision errors:
    
    1) Error injecting constructor, java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
      at org.jenkinsci.main.modules.instance_identity.PageDecoratorImpl.<init>(PageDecoratorImpl.java:20)
    
    1 error
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:52)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
        at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
        at hudson.ExtensionFinder$GuiceFinder._find(ExtensionFinder.java:386)
        at hudson.ExtensionFinder$GuiceFinder.find(ExtensionFinder.java:377)
        at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:470)
        at hudson.ExtensionList.load(ExtensionList.java:349)
        at hudson.ExtensionList.ensureLoaded(ExtensionList.java:287)
        at hudson.ExtensionList.iterator(ExtensionList.java:156)
        at hudson.diagnosis.NullIdDescriptorMonitor.verify(NullIdDescriptorMonitor.java:67)
        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:497)
        at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
        at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:996)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.read(InstanceIdentity.java:89)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.<init>(InstanceIdentity.java:62)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.<init>(InstanceIdentity.java:43)
        at org.jenkinsci.main.modules.instance_identity.PageDecoratorImpl.<init>(PageDecoratorImpl.java:21)
        at org.jenkinsci.main.modules.instance_identity.PageDecoratorImpl$$FastClassByGuice$$68618106.newInstance(<generated>)
        at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
        at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:108)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        ... 26 more
    
    19-Sep-2019 14:25:31.184 WARNING [NullIdDescriptorMonitor.verify] hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.error Failed to instantiate Key[type=org.jenkinsci.main.modules.sshd.SSHD, annotation=[none]]; skipping this component
     com.google.inject.ProvisionException: Guice provision errors:
    
    1) Error injecting constructor, java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
      at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.<init>(InstanceIdentity.java:43)
      while locating org.jenkinsci.main.modules.instance_identity.InstanceIdentity
        for field at org.jenkinsci.main.modules.sshd.SSHD.identity(SSHD.java:33)
    
    1 error
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:52)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:117)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
        at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
        at hudson.ExtensionFinder$GuiceFinder._find(ExtensionFinder.java:386)
        at hudson.ExtensionFinder$GuiceFinder.find(ExtensionFinder.java:377)
        at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:470)
        at hudson.ExtensionList.load(ExtensionList.java:349)
        at hudson.ExtensionList.ensureLoaded(ExtensionList.java:287)
        at hudson.ExtensionList.iterator(ExtensionList.java:156)
        at hudson.diagnosis.NullIdDescriptorMonitor.verify(NullIdDescriptorMonitor.java:67)
        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:497)
        at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
        at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:996)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.read(InstanceIdentity.java:89)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.<init>(InstanceIdentity.java:62)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.<init>(InstanceIdentity.java:43)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity$$FastClassByGuice$$af33f6d9.newInstance(<generated>)
        at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
        at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:108)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:117)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        ... 37 more
    
    19-Sep-2019 14:25:31.187 WARNING [NullIdDescriptorMonitor.verify] hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.error Failed to instantiate Key[type=org.jenkinsci.main.modules.sshd.PortAdvertiser, annotation=[none]]; skipping this component
     com.google.inject.ProvisionException: Guice provision errors:
    
    1) null returned by binding at hudson.ExtensionFinder$GuiceFinder$SezpozModule.configure(ExtensionFinder.java:508)
     but org.jenkinsci.main.modules.sshd.PortAdvertiser.sshd is not @Nullable
      while locating org.jenkinsci.main.modules.sshd.SSHD
        for field at org.jenkinsci.main.modules.sshd.PortAdvertiser.sshd(PortAdvertiser.java:18)
    
    1 error
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:52)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
        at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
        at hudson.ExtensionFinder$GuiceFinder._find(ExtensionFinder.java:386)
        at hudson.ExtensionFinder$GuiceFinder.find(ExtensionFinder.java:377)
        at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:470)
        at hudson.ExtensionList.load(ExtensionList.java:349)
        at hudson.ExtensionList.ensureLoaded(ExtensionList.java:287)
        at hudson.ExtensionList.iterator(ExtensionList.java:156)
        at hudson.diagnosis.NullIdDescriptorMonitor.verify(NullIdDescriptorMonitor.java:67)
        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:497)
        at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
        at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:996)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    
    19-Sep-2019 14:25:31.200 WARNING [NullIdDescriptorMonitor.verify] hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.error Failed to instantiate Key[type=org.jenkinsci.main.modules.sshd.SSHD, annotation=[none]]; skipping this component
     com.google.inject.ProvisionException: Guice provision errors:
    
    1) Error injecting constructor, java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
      at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.<init>(InstanceIdentity.java:43)
      while locating org.jenkinsci.main.modules.instance_identity.InstanceIdentity
        for field at org.jenkinsci.main.modules.sshd.SSHD.identity(SSHD.java:33)
    
    1 error
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:52)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
        at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
        at hudson.ExtensionFinder$GuiceFinder._find(ExtensionFinder.java:386)
        at hudson.ExtensionFinder$GuiceFinder.find(ExtensionFinder.java:377)
        at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:470)
        at hudson.ExtensionList.load(ExtensionList.java:349)
        at hudson.ExtensionList.ensureLoaded(ExtensionList.java:287)
        at hudson.ExtensionList.iterator(ExtensionList.java:156)
        at hudson.diagnosis.NullIdDescriptorMonitor.verify(NullIdDescriptorMonitor.java:67)
        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:497)
        at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
        at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
        at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
        at jenkins.model.Jenkins$7.runTask(Jenkins.java:996)
        at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
        at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.read(InstanceIdentity.java:89)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.<init>(InstanceIdentity.java:62)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.<init>(InstanceIdentity.java:43)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity$$FastClassByGuice$$af33f6d9.newInstance(<generated>)
        at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
        at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:108)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:117)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        ... 26 more
    
    19-Sep-2019 14:25:31.277 WARNING [Jenkins initialization thread] hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.error Failed to instantiate Key[type=org.jenkinsci.main.modules.sshd.SSHD, annotation=[none]]; skipping this component
     com.google.inject.ProvisionException: Guice provision errors:
    
    1) Error injecting constructor, java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
      at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.<init>(InstanceIdentity.java:43)
      while locating org.jenkinsci.main.modules.instance_identity.InstanceIdentity
        for field at org.jenkinsci.main.modules.sshd.SSHD.identity(SSHD.java:33)
    
    1 error
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:52)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:117)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
        at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
        at hudson.ExtensionFinder$GuiceFinder._find(ExtensionFinder.java:386)
        at hudson.ExtensionFinder$GuiceFinder.find(ExtensionFinder.java:377)
        at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:470)
        at hudson.ExtensionList.load(ExtensionList.java:349)
        at hudson.ExtensionList.ensureLoaded(ExtensionList.java:287)
        at hudson.ExtensionList.iterator(ExtensionList.java:156)
        at jenkins.model.Jenkins.fireBeforeShutdown(Jenkins.java:2993)
        at jenkins.model.Jenkins.cleanUp(Jenkins.java:2934)
        at hudson.WebAppMain$3.run(WebAppMain.java:247)
    Caused by: java.lang.ClassCastException: org.bouncycastle.asn1.pkcs.PrivateKeyInfo cannot be cast to org.bouncycastle.openssl.PEMKeyPair
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.read(InstanceIdentity.java:89)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.<init>(InstanceIdentity.java:62)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.<init>(InstanceIdentity.java:43)
        at org.jenkinsci.main.modules.instance_identity.InstanceIdentity$$FastClassByGuice$$af33f6d9.newInstance(<generated>)
        at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)
        at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:61)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:108)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:54)
        at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:132)
        at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:117)
        at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:88)
        at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:269)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1058)
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
        ... 26 more
    
    19-Sep-2019 14:25:31.277 WARNING [Jenkins initialization thread] hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.error Failed to instantiate Key[type=org.jenkinsci.main.modules.sshd.ItemListenerImpl, annotation=[none]]; skipping this component
     com.google.inject.ProvisionException: Guice provision errors:
    
    1) null returned by binding at hudson.ExtensionFinder$GuiceFinder$SezpozModule.configure(ExtensionFinder.java:508)
     but org.jenkinsci.main.modules.sshd.ItemListenerImpl.sshd is not @Nullable
      while locating org.jenkinsci.main.modules.sshd.SSHD
        for field at org.jenkinsci.main.modules.sshd.ItemListenerImpl.sshd(ItemListenerImpl.java:14)
    
    1 error
        at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:52)
        at com.google.inject.Scopes$1$1.get(Scopes.java:65)
        at hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1.get(ExtensionFinder.java:424)
        at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:41)
        at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:1005)
        at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1051)
        at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:1001)
        at hudson.ExtensionFinder$GuiceFinder._find(ExtensionFinder.java:386)
        at hudson.ExtensionFinder$GuiceFinder.find(ExtensionFinder.java:377)
        at hudson.ClassicPluginStrategy.findComponents(ClassicPluginStrategy.java:470)
        at hudson.ExtensionList.load(ExtensionList.java:349)
        at hudson.ExtensionList.ensureLoaded(ExtensionList.java:287)
        at hudson.ExtensionList.iterator(ExtensionList.java:156)
        at jenkins.model.Jenkins.fireBeforeShutdown(Jenkins.java:2993)
        at jenkins.model.Jenkins.cleanUp(Jenkins.java:2934)
        at hudson.WebAppMain$3.run(WebAppMain.java:247)
    
    19-Sep-2019 14:25:31.289 INFO [Jenkins initialization thread] jenkins.model.Jenkins$21.onAttained Started termination
    19-Sep-2019 14:25:31.309 INFO [Jenkins initialization thread] jenkins.model.Jenkins$21.onAttained Completed termination
    19-Sep-2019 14:25:31.309 INFO [Jenkins initialization thread] jenkins.model.Jenkins._cleanUpDisconnectComputers Starting node disconnection
    19-Sep-2019 14:25:31.323 INFO [Jenkins initialization thread] jenkins.model.Jenkins._cleanUpShutdownPluginManager Stopping plugin manager
    19-Sep-2019 14:25:31.323 INFO [Jenkins initialization thread] jenkins.model.Jenkins._cleanUpPersistQueue Persisting build queue
    19-Sep-2019 14:25:31.552 INFO [Jenkins initialization thread] jenkins.model.Jenkins.cleanUp Jenkins stopped
    View Code

    刪掉:/root/.jenkins 目錄。再啓動試下。html

  • 網頁上輸入:ip地址+端口號。訪問jenkins,展現以下圖。

 

  • 在服務器上面輸入:cat /root/.jenkins/secrets/initialAdminPassword 命令。會出現讓輸入的密碼,一串數字字母,將拿到的密碼輸入到裏面下一步,展現以下圖:

  •  點第一個安裝所有插件,若是知道用什麼插件點第二個。完成以下圖:

 

  •  點擊繼續以下圖:

 

  •  填下內容後保存並完成

 

  • 開始使用,點擊就會進來

  •  安裝插件:以下圖:(過濾中搜索,勾選上直接安裝)須要安裝的插件有:git、ssh、maven

 

 

  •  jenkins中配置環境:

 

 

 

 

 

 

 

 

  •  構建項目:

 

 

 

 

 

 

  • 生成git祕鑰:ssh-keygen -t rsa -C "註冊github時的郵箱"。這兩文件中pub結尾的配置到github上面,另外一個配置到jenkins上面。

 

 

 

 

 

  •  腳本:
    export BUILD_ID=dontkillme
    echo ‘嘗試關閉tomcat…’ 
    sh /home/apache-tomcat-8.0.43/bin/shutdown.sh; 
    tom_pid=ps -ef|grep apache-tomcat-8.5.23|grep -v grep| awk '{print $2}' 
    #若是tom_pid長度不爲零 not-zero 
    if [ $tom_pid ]; 
    then 
    echo 「tomcat 關閉失敗,將強制結束進程:$tom_pid」 
    kill -9 $tom_pid; 
    fi 
    echo 「tomcat 進程結束」 
    echo 「清空weapps目錄並複製新war包…」 
    rm -rf /home/apache-tomcat-8.0.43/webapps/*
    cp /root/.jenkins/workspace/web/target/webSocket.war /home/apache-tomcat-8.0.43/webapps/; 
    echo 「從新啓動tomcat…」 
    cd /home/apache-tomcat-8.0.43/bin/
    ./startup.sh

 

 

 

 

 

 

 

 


 


  • 安裝maven:下載地址:apache-maven-3.3.9-bin.tar.gz  。解壓到:/usr/local目錄下。 配置環境變量:vim  /etc/profile
    export M2_HOME=/usr/local/apache-maven-3.3.9
    export M2=$M2_HOME/bin
    export PATH=$M2:$PATH
  • 查看maven是否配置成功:

 


 


  • 安裝Git(yum源進行安裝):yum install git。Git默認安裝在:/usr/libexec/git-core  目錄下。查看Git安裝版本:

  • 這種安裝的Gitb版本比較低,安裝高版本Git能夠經過源碼編譯安裝:
  1. 獲取github最新的Git安裝包下載連接,進入Linux服務器,執行下載,命令爲: wget https://github.com/git/git/archive/v2.17.0.tar.gz ;
  2. 壓縮包解壓,命令爲: tar -zxvf v2.17.0.tar.gz ;
  3. 安裝編譯源碼所需依賴,命令爲: yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker 耐心等待安裝,出現提示輸入y便可;
  4. 安裝依賴時,yum自動安裝了Git,須要卸載舊版本Git,命令爲: yum remove git 出現提示輸入y便可;
  5. 進入解壓後的文件夾,命令 cd git-2.17.0 ,而後執行編譯,命令爲 make prefix=/usr/local/git all 耐心等待編譯便可;
  6. 安裝Git至/usr/local/git路徑,命令爲 make prefix=/usr/local/git install ;
  7. 打開環境變量配置文件,命令 vim /etc/profile ,在底部加上Git相關配置信息:java

    PATH=$PATH:/usr/local/git/bin 

    export PATH 
    node

    而後保存,退出!react

  8. 輸入命令 git --version ,查看安裝的git版本,校驗經過,安裝成功。

 


 


 

  • 參考:
  1. http://www.javashuo.com/article/p-pgwdnpdu-dw.html
  2. http://www.javashuo.com/article/p-hwuqrehw-cr.html
  3. http://www.javashuo.com/article/p-rtgrmvyg-by.html
  • 問題:
    • jenkins自動部署中執行shell腳本啓動tomcat,可是tomcat不啓動的問題。git

    1. 參考:http://www.javashuo.com/article/p-btmyifyh-er.html
    2. 處理:
      1.啓動 Jenkins 的時候加上 -Dhudson.util.ProcessTree.disable=true2.在後臺進程前加上 BUILD_ID=dontkillme。
相關文章
相關標籤/搜索