11

I'm trying to install Liferay on Ubuntu Server 12.04, which requires JRE and recommends version 6.

I can't find JRE6 in an authoritative repository, and I can't work out how to get past the licence agreement for a manual (wget) download.

Can I add a value to wget to accept the Oracle licence agreement and download the file?

Thanks

ish
  • 141,990
tomtomnz
  • 213

6 Answers6

11

"Automated" Oracle Java Downloads (JRE/JDK 6/7 and others...)

You will need sqlite3 installed; it's a tiny package, use sudo apt-get install sqlite3 if you need to.

  1. Open Firefox, go to the Java downloads page for the version/variant you need, and click on the Accept License Agreement radio button.

    enter image description here

  2. Open a terminal, and paste this to extract the necessary Oracle session cookies from the Firefox SQLite cookie database into a cookies format text file wget can use (source for script):

    echo ".mode tabs
    select host, case when host glob '.*' then 'TRUE' else 'FALSE' end, path,
    case when isSecure then 'TRUE' else 'FALSE' end, expiry, name, value
    from moz_cookies;" | sqlite3 ~/.mozilla/firefox/*.default/cookies.sqlite
    | grep -i oracle > /tmp/oracle-cookies.txt
    
  3. Now use wget to download with those session cookies:

    wget --load-cookies=/tmp/oracle-cookies.txt wget http://download.oracle.com/otn-pub/java/jdk/6u14-b08/jdk-6u14-linux-x64.bin
    
  4. Notes:

    • You can use these cookies for any Oracle download as long as it comes from the otn-pub directory
    • You can paste the script in to a .sh file for easier use
    • The cookies are not associated with IP, so for a headless/CLI server, simply SCP or transfer the cookies file and you can download from any computer (but there is a 30-minute timeout on the cookie, so beware)
    • Related: How do I use wget/curl to download from a site I am logged into?
ish
  • 141,990
6

There is a similar question on stackoverflow: How to automate download and instalation of Java JDK on Linux?

The answer using wget is:

wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64.tar.gz"

The last argument is the url to download from. Different java version archives differ not only in version, but extension too.

6

A tip from mkyong.com: you can use wget --header "Cookie: oraclelicense=accept-securebackup-cookie" [link from download page] to download without needing to extract cookies from your browser.

Periata Breatta
  • 161
  • 1
  • 2
1

As an addition to izx answer, there is a chrome plugin you can use to export your cookies, so you do not have to use sqlite.

pushy
  • 111
  • 2
0

A quick way with out cookies:

  • Start the download in your browser
  • Pause the download
  • Copy the url being used for the download
  • Use the url with wget: wget --no-check-certificate URL_FOR_DOWNLOAD

The URL is probably only valid for a limited amount of time (often 30minutes).

0

Actually, just get the content given by the chrome extension mentioned by pushy in a file on your linux. Then copy the dl adresse from oracle page and add it to your wget command. For example, to dl Oracle Database 11g Release 2 (11.2.0.1.0):

vagrant@vagrant-ubuntu-trusty-64:~/download$ wget -x --load-cookies cookies.txt http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_1of2.zip