Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install Latest Java 7 and Java 8 on Ubuntu 14.04 LTS
### Fucking Linux
It’s 2014, and this is what I had to do to install Java 7 and 8 on latest Ubuntu LTS (Trusty 14.04.1):
$ vagrant box add box-cutter/ubuntu1404 && vagrant init box-cutter/ubuntu1404
$ vagrant ssh
$ apt-get update && sudo apt-get upgrade
$ apt-get software-properties-common
$ apt-get install software-properties-common
$ add-apt-repository ppa:webupd8team/java
$ apt-get update
$ apt-get install oracle-java8-installer
$ apt-get install oracle-java7-installer
$ update-java-alternatives -s java-8-oracle
Somehow I think this is a few notches below useful. More gory details are below.
<http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html>
<http://askubuntu.com/questions/445536/unable-to-locate-package-add-apt-repository-error>
config.vm.provision "shell", inline: <<-SHELL
apt-get -y -q update
apt-get -y -q upgrade
apt-get -y -q install software-properties-common htop
add-apt-repository ppa:webupd8team/java
apt-get -y -q update
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
apt-get -y -q install oracle-java8-installer
apt-get -y -q install oracle-java7-installer
update-java-alternatives -s java-8-oracle
SHELL
# Add the following line inside the block to install Linux perf tools
# apt-get -y -q install linux-tools-generic linux-cloud-tools-generic linux-tools-3.13.0-40-generic linux-cloud-tools-3.13.0-40-generic
@supercargo
Copy link

supercargo commented Dec 27, 2014

the java cookbook I'm using (chef) never seems to work more than once.

@tinkerware
Copy link
Author

tinkerware commented Jan 16, 2015

Is that not a general problem with Chef? I try to use Ansible these days; I've found it reliable.

@yev
Copy link

yev commented Feb 10, 2016

Thank you for sharing this script, especially accepting licence part :)

@Jacobvu84
Copy link

Jacobvu84 commented Apr 25, 2017

Thank you so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment