Skip to content

Instantly share code, notes, and snippets.

@tinkerware
Last active January 21, 2019 01:11
  • Star 20 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tinkerware/cf0c47bb69bf42c2d740 to your computer and use it in GitHub Desktop.
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

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

@tinkerware
Copy link
Author

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

Thank you so much

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