title: Jenkins run up an Amazon EC2 Linux Ubuntu instance failing
body: <p>I have configured and tried to run Jenkins System Configuration from AWS windows system: </p>
  
  <p>It is failed and thrown the fallowing error.</p>
  
  <p>I insalled manually Java 1.7</p>
  
  <hr>
  
  <pre><code>Jun 29, 2018 6:22:29 PM null
  FINEST: Node RocketChat-Server (i-034fb93609641e1b1)(i-034fb93609641e1b1) is still pending/launching, waiting 5s
  Jun 29, 2018 6:22:35 PM null
  FINEST: Node RocketChat-Server (i-034fb93609641e1b1)(i-034fb93609641e1b1) is still pending/launching, waiting 5s
  Jun 29, 2018 6:22:40 PM null
  FINEST: Node RocketChat-Server (i-034fb93609641e1b1)(i-034fb93609641e1b1) is still pending/launching, waiting 5s
  Jun 29, 2018 6:22:45 PM null
  FINEST: Node RocketChat-Server (i-034fb93609641e1b1)(i-034fb93609641e1b1) is still pending/launching, waiting 5s
  
  Jun 29, 2018 6:22:50 PM null
  FINER: Node RocketChat-Server (i-034fb93609641e1b1)(i-034fb93609641e1b1) is ready
  Jun 29, 2018 6:22:50 PM null
  INFO: Launching instance: i-034fb93609641e1b1
  Jun 29, 2018 6:22:50 PM null
  INFO: bootstrap()
  Jun 29, 2018 6:22:50 PM null
  INFO: Getting keypair...
  Jun 29, 2018 6:22:50 PM null
  INFO: Using key: FirstKeyPair
  e8:59:89:73:4b:c5:55:1a:f9:18:85:95:a7:53:4c:a4:27:a1:a2:26
  -----BEGIN RSA PRIVATE KEY-----
  MIIEogIBAAKCAQEAlZa6EHKfbQ2Fro4pEVhb/rPwlDRpZoUYZTVzzFbLTSajMTYj3PaiZzTBcLlY
  lmiJfb7wtIJJ/xo9/SxdUXZHK6b3JBrfHUH7TVGW060ugeeJmfb
  Jun 29, 2018 6:22:50 PM null
  INFO: Authenticating as ubuntu
  Jun 29, 2018 6:22:50 PM null
  INFO: Connecting to ec2-35-178-118-236.eu-west-2.compute.amazonaws.com on port 22, with timeout 10000.
  
  Jun 29, 2018 6:22:59 PM null
  INFO: Failed to connect via ssh: There was a problem while connecting to ec2-35-178-118-236.eu-west-2.compute.amazonaws.com:22
  Jun 29, 2018 6:22:59 PM null
  INFO: Waiting for SSH to come up. Sleeping 5.
  
  Jun 29, 2018 6:23:04 PM null
  INFO: Connecting to ec2-35-178-118-236.eu-west-2.compute.amazonaws.com on port 22, with timeout 10000.
  
  Jun 29, 2018 6:23:04 PM null
  INFO: Connected via SSH.
  Jun 29, 2018 6:23:04 PM null
  INFO: connect fresh as root
  Jun 29, 2018 6:23:04 PM null
  INFO: Connecting to ec2-35-178-118-236.eu-west-2.compute.amazonaws.com on port 22, with timeout 10000.
  Jun 29, 2018 6:23:05 PM null
  INFO: Connected via SSH.
  Jun 29, 2018 6:23:05 PM null
  INFO: Creating tmp directory (/tmp) if it does not exist
  
  Jun 29, 2018 6:23:06 PM null
  INFO: Verifying: java -fullversion
  bash: java: command not found
  Jun 29, 2018 6:23:06 PM null
  INFO: Installing: sudo yum install -y java-1.8.0-openjdk.x86_64
  sudo: yum: command not found
  Jun 29, 2018 6:23:06 PM null
  WARNING: Failed to install: sudo yum install -y java-1.8.0-openjdk.x86_64
  Jun 29, 2018 6:23:06 PM null
  INFO: Verifying: which scp
  /usr/bin/scp
  Jun 29, 2018 6:23:06 PM null
  INFO: Copying slave.jar to: /tmp
  Jun 29, 2018 6:23:06 PM null
  INFO: Launching slave agent (via Trilead SSH2 Connection):  java  -jar /tmp/slave.jar
  ERROR: SSH channel is closed
  </code></pre>
  
  <blockquote>
    <p>java.io.IOException: SSH channel is closed
            at >com.trilead.ssh2.channel.ChannelManager.ioException(ChannelManager.java:1543)
            at >com.trilead.ssh2.channel.ChannelManager.sendData(ChannelManager.java:373)
            at >com.trilead.ssh2.channel.ChannelOutputStream.write(ChannelOutputStream.java:63)
            at hudson.remoting.BinarySafeStream$2._write(BinarySafeStream.java:272)
            at hudson.remoting.BinarySafeStream$2.write(BinarySafeStream.java:255)
            at java.io.ObjectOutputStream$BlockDataOutputStream.drain(Unknown Source)
            at >java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(Unknown Source)
            at java.io.ObjectOutputStream.writeNonProxyDesc(Unknown Source)
            at java.io.ObjectOutputStream.writeClassDesc(Unknown Source)
            at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
            at java.io.ObjectOutputStream.writeObject0(Unknown Source)
            at java.io.ObjectOutputStream.writeFatalException(Unknown Source)
            at java.io.ObjectOutputStream.writeObject(Unknown Source)
            at hudson.remoting.Capability.writePreamble(Capability.java:142)
            at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:388)
            at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:354)
            at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:415)
            at >hudson.plugins.ec2.ssh.EC2UnixLauncher.launch(EC2UnixLauncher.java:217)
            at >hudson.plugins.ec2.EC2ComputerLauncher.launch(EC2ComputerLauncher.java:122)
            at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:288)
            at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
            at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
            at java.util.concurrent.FutureTask.run(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)
            Suppressed: java.io.IOException: SSH channel is closed
                at com.trilead.ssh2.channel.ChannelManager.ioException(ChannelManager.java:1543)
                at com.trilead.ssh2.channel.ChannelManager.sendData(ChannelManager.java:373)
                at com.trilead.ssh2.channel.ChannelOutputStream.write(ChannelOutputStream.java:63)
                at hudson.remoting.BinarySafeStream$2._write(BinarySafeStream.java:272)
                at hudson.remoting.BinarySafeStream$2.write(BinarySafeStream.java:255)
                at java.io.ObjectOutputStream$BlockDataOutputStream.drain(Unknown Source)
                at java.io.ObjectOutputStream$BlockDataOutputStream.flush(Unknown Source)
                at java.io.ObjectOutputStream.flush(Unknown Source)
                at hudson.remoting.Capability$1.close(Capability.java:132)
                at hudson.remoting.Capability.writePreamble(Capability.java:144)
                ... 12 more
            Caused by: java.io.IOException: Close requested by remote
                at com.trilead.ssh2.channel.Channel.setReasonClosed(Channel.java:331)
                at com.trilead.ssh2.channel.ChannelManager.msgChannelClose(ChannelManager.java:1254)
                at com.trilead.ssh2.channel.ChannelManager.handleMessage(ChannelManager.java:1475)
                at com.trilead.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:809)
                at >com.trilead.ssh2.transport.TransportManager$1.run(TransportManager.java:502)
                ... 1 more
          [CIRCULAR REFERENCE:java.io.IOException: Close requested by remote]</p>
  </blockquote>
  
  <hr>