3

I need to install Java 1.7 on several machines and hence I want to do it using a script. The problem is the installation asks for certain options (to be specific 'Y', then 'OK' and finally 'Yes'). I came across this question:

Automate the installation of postfix on Ubuntu

I am pretty sure the process is on the same lines. But I don't know how did the OP know about the variable names (?) like postfix postfix/mailname etc.

If someone can provide a more direct answer, it will be most appreciated.

EDIT 1:

I tried setting sudo dpkg-reconfigure debconf to non-interactive and selecting alert level as critial. Then I tried to execute sudo apt-get install oracle-java7-installer and got this error:

Need to get 0 B/18.6 kB of archives.
After this operation, 193 kB of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 47992 files and directories currently installed.)
Unpacking oracle-java7-installer (from .../oracle-java7-installer_7u51-0~webupd8~4_all.deb) ...

oracle-license-v1-1 license could not be presented
try 'dpkg-reconfigure debconf' to select a frontend other than noninteractive

dpkg: error processing /var/cache/apt/archives/oracle-java7-installer_7u51-0~webupd8~4_all.deb (--unpack):
 subprocess new pre-installation script returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/oracle-java7-installer_7u51-0~webupd8~4_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

2 Answers 2

5

Presumably the same as with Java 8:

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

apt-get -y install oracle-java7-installer oracle-java7-set-default
0

apt-get install -y --force-yes oracle-java7-installer should do the trick

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.