Install Sun Java with Puppet on Ubuntu

Sun wants you to agree to its license before installing the JRE/JDK. For an unattended install you need a preseed file.
You get the content of this file with „debconf-get-selections | grep sun-„ on a system where you have already installed the required packages.

Create a file „/etc/puppet/files/sun-java6.preseed“ with the following example content:

sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true
sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true
sun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true
sun-java6-jre sun-java6-jre/stopthread boolean true
sun-java6-jre sun-java6-jre/jcepolicy note
sun-java6-bin shared/error-sun-dlj-v1-1 error
sun-java6-jdk shared/error-sun-dlj-v1-1 error
sun-java6-jre shared/error-sun-dlj-v1-1 error
sun-java6-bin shared/present-sun-dlj-v1-1 note
sun-java6-jdk shared/present-sun-dlj-v1-1 note
sun-java6-jre shared/present-sun-dlj-v1-1 note

I use this APT-Module to add the Ubuntu partner repository. (Required for Sun-Packages)

apt::source { "partner":
    location => "http://archive.canonical.com/ubuntu",
    release => "${lsbdistcodename}",
    repos => "partner",
    include_src => false,
}

Now you can install the sun package:

 
file { "/var/cache/debconf/sun-java6.preseed":
    source => "puppet://$server/filesserver/sun-java6.preseed",
    ensure => present
}
package { "sun-java6-jdk":
    ensure  => installed,
    responsefile => "/var/cache/debconf/sun-java6.preseed",
    require => [ Apt::Source["partner"], File["/var/cache/debconf/sun-java6.preseed"] ],
}

Note: I use sun-java6-jdk but you can install sun-java5-jre in the same way.

This Post Has 4 Comments

  1. This saved me so much time. Thank you!

  2. probably „source => „puppet://$server/filesserver/sun-java6.preseed“ should be „source => „puppet://$server/files/sun-java6.preseed“,

    1. This depends on your specific configuration.

      files if you use this in a module and fileserver if you use the global fileserver path. (/etc/puppet/files/)

      And check „/etc/puppet/fileserver.conf“

      [fileserver]
      path /etc/puppet/files

      1. Ok, I just notice default is it [files] instead of [fileserver] in my ubuntu (puppet 2.6.4).

        And probably it is fileserver instead of filesserver.

        Anyway, very nice article, useful for me.

Schreibe einen Kommentar

eMail-Benachrichtigung bei weiteren Kommentaren.
Auch möglich: Abo ohne Kommentar.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.