...
Code Block | ||||
---|---|---|---|---|
| ||||
sudo add-apt-repository ppa:webupd8team/java sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 sudo apt-get update sudo apt-get install oracle-java8-installer |
...
Code Block | ||
---|---|---|
| ||
export J2SDKDIR=/usr/lib/jvm/default-java export J2REDIR=/usr/lib/jvm/default-java/jre export PATH=$PATH:/usr/lib/jvm/default-java/bin:/usr/lib/jvm/default-java/db/bin:/usr/lib/jvm/default-java/jre/bin:$PATH export JAVA_HOME=/usr/lib/jvm/default-java export DERBY_HOME=/usr/lib/jvm/default-java/db |
...
Code Block | ||
---|---|---|
| ||
setenv J2SDKDIR /usr/lib/jvm/default-java setenv J2REDIR /usr/lib/jvm/default-java/jre setenv PATH ${PATH}:/usr/lib/jvm/default-java/bin:/usr/lib/jvm/default-java/db/bin:/usr/lib/jvm/default-java/jre/bin:${PATH} setenv JAVA_HOME /usr/lib/jvm/default-java setenv DERBY_HOME /usr/lib/jvm/default-java/db |
...
The installer fetches the latest Java binary via wget.
Most of the time, the download fails because either the firewall blocks it or because the cacher doesn't allow it.
Since Java updates are not very frequent, we can turn off the firewall while installing, but the cacher can at least be configured for a permanent bypass.
Create /etc/apt/apt.conf.d/03java-bypass with the following contents:
...
This will ensure that downloads from download.oracle.com initiated by pre/post-install scripts do not go through the cacher.
The ideal solution would be to make them cached but that needs a regex hack for apt-cacher-ng (to stop it from rejecting this site as a cacheable source) which I was not able to develop yet.
A workaround has been found for this problem:
According to this http://askubuntu.com/a/503992
One can add the following pattern in the acng.conf file.
Code Block | ||
---|---|---|
| ||
PfilePattern = .*(\.d?deb|\.rpm|\.drpm|\.dsc|\.tar(\.gz|\.bz2|\.lzma|\.xz)(\.gpg|\?AuthParam=.*)?|\.diff(\.gz|\.bz2|\.lzma|\.xz)|\.jigdo|\.template|changelog|copyright|\.udeb|\.debdelta|\.diff/.*\.gz|(Devel)?ReleaseAnnouncement(\?.*)?|[a-f0-9]+-(susedata|updateinfo|primary|deltainfo).xml.gz|fonts/(final/)?[a-z]+32.exe(\?download.*)?|/dists/.*/installer-[^/]+/[0-9][^/]+/images/.*)$ |
However the trick is to help acng to send a HTTP cookie with each and every request so the following pattern is also necessary in acng.conf:
Code Block | ||
---|---|---|
| ||
RequestAppendix: Cookie: oraclelicense=a |
Auto accept license
Code Block | ||
---|---|---|
| ||
echo oracle-java9-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections |
or
Code Block | ||
---|---|---|
| ||
echo oracle-java8-installer shared/accepted-oracle-licence-v1-1 boolean true | sudo /usr/bin/debconf-set-selections |
Architecture
If your host architecture differs from LTSP chroot, you won't be able to install Java this way. Chrooting will make the chroot report the host's architecture to the installer, which causes it to download the wrong binary. Generally, chroots should be kept the same architecture as host, but if they must be different, one can still install Java this way if live-boot from the correct architecture media is done and chroot is entered from it.
...
Code Block | ||||
---|---|---|---|---|
| ||||
user@machine:/usr/lib/jvm/tools$ ls -al /usr/lib/firefox-addons/plugins/ total 8 drwxr-xr-x 2 root root 4096 Jul 13 11:07 . drwxr-xr-x 6 root root 4096 Aug 18 2012 .. |
Reference
http://www.webupd8.org/2015/02/install-oracle-java-9-in-ubuntu-linux.html