Sebastian Mogilowskis Blog

Just another blog about administration, linux and other stuff

Language: German English

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.

, , ,

4 Responses to “Install Sun Java with Puppet on Ubuntu”

  • Matt says:

    This saved me so much time. Thank you!

  • larry says:

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

    • sebastian says:

      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

      • larry says:

        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.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

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