Auto yes to the License Agreement on sudo apt-get -y install oracle-java7-installer [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.

This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.

Closed last year . The community reviewed whether to reopen this question last year and left it closed:
Original close reason(s) were not resolved

The Oracle Java package for Ubuntu interactively asks about the License Agreement. So I have to say 'OK' and then 'yes' every time, but I'd like to automate it. What I do is this:

sudo add-apt-repository -y ppa:webupd8team/java sudo apt-get update sudo apt-get -y install oracle-java7-installer 
Is there a simple way to automate the agreement process without using expect? 3,928 2 2 gold badges 33 33 silver badges 59 59 bronze badges asked Oct 9, 2013 at 15:09 872 1 1 gold badge 10 10 silver badges 10 10 bronze badges

Since you're asking about the usage of the Ubuntu/Debian package manager, your question would better fit on Ask Ubuntu or Unix & Linux Stack Exchange.

Commented Oct 10, 2013 at 13:02 On askubuntu: askubuntu.com/questions/190582/… Commented Jan 25, 2015 at 22:05

5 Answers 5

sudo add-apt-repository -y ppa:webupd8team/java sudo apt-get update 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 -y install oracle-java7-installer 

running 3rd and 4th command on my debian 7.1 helps, so I think the same can help on ubuntu as well

answered Oct 15, 2013 at 21:04 11.9k 3 3 gold badges 45 45 silver badges 48 48 bronze badges

@KJTanaka: you are welcome! please consider to accept it as a solution then ;) or ask more details if it does not solve your entire problem. thanks

Commented Oct 20, 2013 at 19:04

Part of it is documented online at Ubuntu's add-apt-repository, apt-get and debconf manuals. You can also use the command line to get the details.

Commented May 30, 2015 at 8:02

A small note, the license number changes over time, I had to adjust to v1-3 , surely it could increment again in the future.

Commented Aug 4, 2022 at 22:11

If you are using Ansible for automation you may want to put this into your playbook:

tasks: - name: add java PPA apt_repository: repo: "ppa:webupd8team/java" - name: accept oracle license debconf: name: "oracle-java7-installer" question: "shared/accepted-oracle-license-v1-1" value: "true" vtype: "select" - name: install jdk apt: name: "oracle-java7-installer" 

Note: The value argument in debconf must be set to "true" , including the quotes, as per comment by Roy Wood.

9,731 2 2 gold badges 31 31 silver badges 35 35 bronze badges answered Oct 27, 2014 at 15:40 1,561 2 2 gold badges 26 26 silver badges 43 43 bronze badges

it also works with oracle-java8-installer using - name: accept oracle license debconf: name='oracle-java8-installer' question='shared/accepted-oracle-license-v1-1' value='true' vtype='select'

Commented Jul 8, 2015 at 15:22

Note that it's critical to use quotes on the debconf value! If you use just "value: true" in your playbook, then the value in the debconf database gets set to "True" and the silent installation will fail with the usual warning of "oracle-license-v1-1 license could not be presented". You have to specify "value: 'true' " in the playbook to ensure that the debconf setting is set to 'true', which is the exact string the Oracle installer looks for!

Commented May 31, 2017 at 15:08 I wish more system configuration questions were answered with Ansible syntax :D Commented Jun 21, 2017 at 7:35

ppa:linuxuprising/java && oracle-java11-installer

For anyone using the Linux Uprising Java 11 installer that stumble across this, see these:

  1. https://launchpad.net/~linuxuprising/+archive/ubuntu/java
  2. https://www.linuxuprising.com/2018/10/how-to-install-oracle-java-11-in-ubuntu.html

Instead of the commands in the answer (as listed on their site), you want this:

echo oracle-java11-installer shared/accepted-oracle-license-v1-2 select true | \ sudo /usr/bin/debconf-set-selections 

Here's my Docker setup for an Ubuntu 18.04-based container:

RUN apt-get update && apt-install -y software-properties-common && \ add-apt-repository -y ppa:linuxuprising/java && \ apt-get update && \ echo oracle-java11-installer shared/accepted-oracle-license-v1-2 select true | sudo /usr/bin/debconf-set-selections && \ apt-get install -y oracle-java11-installer && \ apt install oracle-java11-set-default