As far as I know, yes, it is legal to install the Oracle JDK on Linux. The main thing to consider is the Oracle Binary Code License Agreement for Java SE, which you must accept before you can download the JDK. The text of the agreement that seems to be most pertinent to your question is:
"2. LICENSE TO USE. Subject to the terms and conditions of this Agreement including, but not limited to, the Java Technology Restrictions of the Supplemental License Terms, Oracle grants you a non-exclusive, non-transferable, limited license without license fees to reproduce and use internally the Software complete and unmodified for the sole purpose of running Programs. THE LICENSE SET FORTH IN THIS SECTION 2 DOES NOT EXTEND TO THE COMMERCIAL FEATURES. YOUR RIGHTS AND OBLIGATIONS RELATED TO THE COMMERCIAL FEATURES ARE AS SET FORTH IN THE SUPPLEMENTAL TERMS ALONG WITH ADDITIONAL LICENSES FOR DEVELOPERS AND PUBLISHERS." (Source:
BCL For Java SE)
Note that it mentions "COMMERCIAL FEATUES". These are the features that are listed at
Java SE Products.
As usual, when in doubt, consult your legal advisor.