Skip to content

Instantly share code, notes, and snippets.

@mugli
Created January 30, 2014 21:51
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mugli/8720670 to your computer and use it in GitHub Desktop.
Save mugli/8720670 to your computer and use it in GitHub Desktop.
Silently install Oracle Java 7 on Ubuntu (without license agreement step)
#!/bin/bash
sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
# Enable silent install
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
sudo apt-get install -y oracle-java7-installer
# Not always necessary, but just in case...
sudo update-java-alternatives -s java-7-oracle
# Setting Java environment variables
sudo apt-get install -y oracle-java7-set-default
@rdenadai
Copy link

rdenadai commented Nov 4, 2015

Thanks for sharing!! I need it the Enable silent install!!!!

@csherrell
Copy link

Thank you for sharing. I am setting up Cassandra using Vagrant and needed this for the boot strap. I updated it for Java 8. Based on the following instructions:

http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html

# Install Oracle Java 8
sudo aptitude install -y python-software-properties
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list.d/webupd8team-java.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
sudo aptitude update
# Enable silent install
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
sudo aptitude -y install oracle-java8-installer
sudo update-java-alternatives -s java-8-oracle
sudo apt-get install -y oracle-java8-set-default

@mpouttuclarke
Copy link

Thanks for this!

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