I like to to automate all the tasks I do often and of the things many of my virtual servers need is Java JDK. Unfortunately the Oracle JDK is not available as debian package but there’s a way to make it. This is where WebUpd8 Team PPA comes in as they provide installer for java6, java7 and java8.
Below is the script I use to install it unattended. You can download it also from github gist. If you want Java6 then just use oracle-java6-installer and for Java 8 oracle-java8-installer. This also works other ubuntu versions just substitute trusty with the code of your ubuntu release like precise for Ubuntu 12.04. Hope you find this useful.
cat - <<-EOF >> /etc/apt/sources.list.d/webupd8team-java.list # webupd8team repository list deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main # deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main EOF apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xEEA14886 echo debconf shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections echo debconf shared/accepted-oracle-license-v1-1 seen true | /usr/bin/debconf-set-selections apt-get update apt-get install oracle-java7-installer