How to Install Amazon Corretto in Ubuntu Linux? [closed]










4















How can we install Amazon Corretto in Ubuntu OS.










share|improve this question















closed as off-topic by Stephen C, Billal Begueradj, user7294900, DanielBarbarian, Moira Jan 16 at 8:53


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – Stephen C, Billal Begueradj, user7294900, DanielBarbarian, Moira
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1





    You can't use docker? (docs.aws.amazon.com/de_de/corretto/latest/corretto-8-ug/…)

    – rob
    Nov 15 '18 at 7:11















4















How can we install Amazon Corretto in Ubuntu OS.










share|improve this question















closed as off-topic by Stephen C, Billal Begueradj, user7294900, DanielBarbarian, Moira Jan 16 at 8:53


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – Stephen C, Billal Begueradj, user7294900, DanielBarbarian, Moira
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1





    You can't use docker? (docs.aws.amazon.com/de_de/corretto/latest/corretto-8-ug/…)

    – rob
    Nov 15 '18 at 7:11













4












4








4


1






How can we install Amazon Corretto in Ubuntu OS.










share|improve this question
















How can we install Amazon Corretto in Ubuntu OS.







java linux ubuntu corretto






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 12:13







Yash

















asked Nov 15 '18 at 6:28









YashYash

577




577




closed as off-topic by Stephen C, Billal Begueradj, user7294900, DanielBarbarian, Moira Jan 16 at 8:53


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – Stephen C, Billal Begueradj, user7294900, DanielBarbarian, Moira
If this question can be reworded to fit the rules in the help center, please edit the question.







closed as off-topic by Stephen C, Billal Begueradj, user7294900, DanielBarbarian, Moira Jan 16 at 8:53


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming. You may be able to get help on Super User." – Stephen C, Billal Begueradj, user7294900, DanielBarbarian, Moira
If this question can be reworded to fit the rules in the help center, please edit the question.







  • 1





    You can't use docker? (docs.aws.amazon.com/de_de/corretto/latest/corretto-8-ug/…)

    – rob
    Nov 15 '18 at 7:11












  • 1





    You can't use docker? (docs.aws.amazon.com/de_de/corretto/latest/corretto-8-ug/…)

    – rob
    Nov 15 '18 at 7:11







1




1





You can't use docker? (docs.aws.amazon.com/de_de/corretto/latest/corretto-8-ug/…)

– rob
Nov 15 '18 at 7:11





You can't use docker? (docs.aws.amazon.com/de_de/corretto/latest/corretto-8-ug/…)

– rob
Nov 15 '18 at 7:11












4 Answers
4






active

oldest

votes


















5














At Preview Ubuntu is not supported. The distribution for Ubuntu will be available at GA, which is planned for Q1 2019. See this AWS blog






share|improve this answer

























  • This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review

    – Sagar Zala
    Nov 16 '18 at 5:57






  • 2





    @SagarZala "it's not available yet" is also an answer, even if it's not what the asked wanted.

    – arnt
    Nov 16 '18 at 8:44











  • @arnt However, imho this would have better fitted as a comment

    – Clijsters
    Nov 20 '18 at 8:57






  • 1





    @Clijsters Quite possibly better as a comment, but I think it's good enough as an answer too. After all, it's complete and correct (until the GA release) and that's what answers are supposed to be.

    – arnt
    Nov 20 '18 at 9:26


















4














For the most part, I was able to check out the Corretto sources and build from there after making two patches. Note that this is obviously not supported by Amazon. If you want a supported distribution, wait until it's released with the GA release. This should be obvious, but I've come to know better than to make assumptions here: Do not try this or anything like it on a production or shared system.



OTOH, if you like to experiment and break things, read on!



1. Check out the Corretto source tree.



git clone git@github.com:corretto/corretto-8.git



2. Apply patches.



I encountered two compilation errors (likely due to different compiler versions on Amazon Linux 2 vs Ubuntu 18.04.1 LTS).



% patch -p1
diff --git a/src/hotspot/src/share/vm/code/dependencies.cpp b/src/hotspot/src/share/vm/code/dependencies.cpp
index c284160e..c4c8e9b4 100644
--- a/src/hotspot/src/share/vm/code/dependencies.cpp
+++ b/src/hotspot/src/share/vm/code/dependencies.cpp
@@ -525,7 +525,7 @@ void Dependencies::write_dependency_to(xmlStream* xtty,
xtty->object("x", arg.metadata_value());
}
} else {
- char xn[10]; sprintf(xn, "x%d", j);
+ char xn[12]; sprintf(xn, "x%d", j);
if (arg.is_oop())
xtty->object(xn, arg.oop_value());
else
diff --git a/src/hotspot/src/share/vm/runtime/fprofiler.cpp b/src/hotspot/src/share/vm/runtime/fprofiler.cpp
index 58cb6e89..89aa0cd8 100644
--- a/src/hotspot/src/share/vm/runtime/fprofiler.cpp
+++ b/src/hotspot/src/share/vm/runtime/fprofiler.cpp
@@ -635,7 +635,7 @@ class vmNode : public ProfilerNode improve this answer



share
else {
- char xn[10]; sprintf(xn, "x%d", j);
+ char xn[12]; sprintf(xn, "x%d", j);
if (arg.is_oop())
xtty->object(xn, arg.oop_value());
else
diff --git a/src/hotspot/src/share/vm/runtime/fprofiler.cpp b/src/hotspot/src/share/vm/runtime/fprofiler.cpp
index 58cb6e89..89aa0cd8 100644
--- a/src/hotspot/src/share/vm/runtime/fprofiler.cpp
+++ b/src/hotspot/src/share/vm/runtime/fprofiler.cpp
@@ -635,7 +635,7 @@ class vmNode : public ProfilerNode
const char *name() const return _name;
bool is_compiled() const return true;

- bool vm_match(const char* name) const return strcmp(name, _name) == 0;
+ bool vm_match(const char* name) const return name == NULL ? false : strcmp(name, _name) == 0;

Method* method() return NULL;


Then press Ctrl+D twice. You should see:



patching file src/hotspot/src/share/vm/code/dependencies.cpp
patching file src/hotspot/src/share/vm/runtime/fprofiler.cpp


3. Install dependencies.



This may be a bit of a cat-and-mouse game. In my case, I had everything I needed except for libcups2-dev and libasound2-dev.



apt install -y libcups2-dev libasound2-dev



The configure step (next) was amazingly clear about what it thought was missing.



4. Configure



Configure the source tree:



cd src
./configure


If all goes well, the last lines will say something like:



A new configuration has been successfully created in
/home/dacut/projects/corretto-8/src/build/linux-x86_64-normal-server-release
using default settings.

Configuration summary:
* Debug level: release
* JDK variant: normal
* JVM variants: server
* OpenJDK target: OS: linux, CPU architecture: x86, address length: 64

Tools summary:
* Boot JDK: openjdk version "1.8.0_181" OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1ubuntu0.18.04.1-b13) OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode) (at /usr/lib/jvm/java-8-openjdk-amd64)
* Toolchain: gcc (GNU Compiler Collection)
* C Compiler: Version 7.3.0 (at /usr/bin/gcc)
* C++ Compiler: Version 7.3.0 (at /usr/bin/g++)

Build performance summary:
* Cores to use: 7
* Memory limit: 15757 MB


If this was the case, go on!



If not, you'll see an error message. In my case they were quite helpful:



configure: error: Could not find cups! You might be able to fix this by running 'sudo apt-get install libcups2-dev'. 
configure exiting with result code 1

configure: error: Could not find alsa! You might be able to fix this by running 'sudo apt-get install libasound2-dev'.
configure exiting with result code 1


Install what it advises (step 3), then try again. This may take a few iterations since you only get one message per configure run.



5. Compile



Run make. If all goes well, you'll see something like the following at the end:



## Finished jdk (build time 00:02:07)

----- Build times -------
Start 2018-11-24 13:30:24
End 2018-11-24 13:35:36
00:00:19 corba
00:02:18 hotspot
00:00:12 jaxp
00:00:16 jaxws
00:02:07 jdk
00:00:00 langtools
00:05:12 TOTAL
-------------------------
Finished building OpenJDK for target 'default'


If not... well, now you're deep into the experimentation part.



6. Install



sudo make install


You'll now have a Corretto build in /usr/local/jvm/openjdk-1.8.0-internal.



Disclaimer: Although I work for AWS, this is purely my personal experimentation and I'm speaking for myself only. These steps are neither sanctioned nor endorsed by Amazon or the Corretto team. Proceed with caution!






share
else {
- char xn[10]; sprintf(xn, "x%d", j);
+ char xn[12]; sprintf(xn, "x%d", j);
if (arg.is_oop())
xtty->object(xn, arg.oop_value());
else
diff --git a/src/hotspot/src/share/vm/runtime/fprofiler.cpp b/src/hotspot/src/share/vm/runtime/fprofiler.cpp
index 58cb6e89..89aa0cd8 100644
--- a/src/hotspot/src/share/vm/runtime/fprofiler.cpp
+++ b/src/hotspot/src/share/vm/runtime/fprofiler.cpp
@@ -635,7 +635,7 @@ class vmNode : public ProfilerNode  










4












4








4







For the most part, I was able to check out the Corretto sources and build from there after making two patches. Note that this is obviously not supported by Amazon. If you want a supported distribution, wait until it's released with the GA release. This should be obvious, but I've come to know better than to make assumptions here: Do not try this or anything like it on a production or shared system.



OTOH, if you like to experiment and break things, read on!



1. Check out the Corretto source tree.



git clone git@github.com:corretto/corretto-8.git



2. Apply patches.



I encountered two compilation errors (likely due to different compiler versions on Amazon Linux 2 vs Ubuntu 18.04.1 LTS).



% patch -p1
diff --git a/src/hotspot/src/share/vm/code/dependencies.cpp b/src/hotspot/src/share/vm/code/dependencies.cpp
index c284160e..c4c8e9b4 100644
--- a/src/hotspot/src/share/vm/code/dependencies.cpp
+++ b/src/hotspot/src/share/vm/code/dependencies.cpp
@@ -525,7 +525,7 @@ void Dependencies::write_dependency_to(xmlStream* xtty,
xtty->object("x", arg.metadata_value());

else {
- char xn[10]; sprintf(xn, "x%d", j);
+ char xn[12]; sprintf(xn, "x%d", j);
if (arg.is_oop())
xtty->object(xn, arg.oop_value());
else
diff --git a/src/hotspot/src/share/vm/runtime/fprofiler.cpp b/src/hotspot/src/share/vm/runtime/fprofiler.cpp
index 58cb6e89..89aa0cd8 100644
--- a/src/hotspot/src/share/vm/runtime/fprofiler.cpp
+++ b/src/hotspot/src/share/vm/runtime/fprofiler.cpp
@@ -635,7 +635,7 @@ class vmNode : public ProfilerNode
const char *name() const return _name;
bool is_compiled() const return true;

- bool vm_match(const char* name) const return strcmp(name, _name) == 0;
+ bool vm_match(const char* name) const return name == NULL ? false : strcmp(name, _name) == 0;

Method* method() return NULL;


Then press Ctrl+D twice. You should see:



patching file src/hotspot/src/share/vm/code/dependencies.cpp
patching file src/hotspot/src/share/vm/runtime/fprofiler.cpp


3. Install dependencies.



This may be a bit of a cat-and-mouse game. In my case, I had everything I needed except for libcups2-dev and libasound2-dev.



apt install -y libcups2-dev libasound2-dev



The configure step (next) was amazingly clear about what it thought was missing.



4. Configure



Configure the source tree:



cd src
./configure


If all goes well, the last lines will say something like:



A new configuration has been successfully created in
/home/dacut/projects/corretto-8/src/build/linux-x86_64-normal-server-release
using default settings.

Configuration summary:
* Debug level: release
* JDK variant: normal
* JVM variants: server
* OpenJDK target: OS: linux, CPU architecture: x86, address length: 64

Tools summary:
* Boot JDK: openjdk version "1.8.0_181" OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1ubuntu0.18.04.1-b13) OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode) (at /usr/lib/jvm/java-8-openjdk-amd64)
* Toolchain: gcc (GNU Compiler Collection)
* C Compiler: Version 7.3.0 (at /usr/bin/gcc)
* C++ Compiler: Version 7.3.0 (at /usr/bin/g++)

Build performance summary:
* Cores to use: 7
* Memory limit: 15757 MB


If this was the case, go on!



If not, you'll see an error message. In my case they were quite helpful:



configure: error: Could not find cups! You might be able to fix this by running 'sudo apt-get install libcups2-dev'. 
configure exiting with result code 1

configure: error: Could not find alsa! You might be able to fix this by running 'sudo apt-get install libasound2-dev'.
configure exiting with result code 1


Install what it advises (step 3), then try again. This may take a few iterations since you only get one message per configure run.



5. Compile



Run make. If all goes well, you'll see something like the following at the end:



## Finished jdk (build time 00:02:07)

----- Build times -------
Start 2018-11-24 13:30:24
End 2018-11-24 13:35:36
00:00:19 corba
00:02:18 hotspot
00:00:12 jaxp
00:00:16 jaxws
00:02:07 jdk
00:00:00 langtools
00:05:12 TOTAL
-------------------------
Finished building OpenJDK for target 'default'


If not... well, now you're deep into the experimentation part.



6. Install



sudo make install


You'll now have a Corretto build in /usr/local/jvm/openjdk-1.8.0-internal.



Disclaimer: Although I work for AWS, this is purely my personal experimentation and I'm speaking for myself only. These steps are neither sanctioned nor endorsed by Amazon or the Corretto team. Proceed with caution!






share
else {
- char xn[10]; sprintf(xn, "x%d", j);
+ char xn[12]; sprintf(xn, "x%d", j);
if (arg.is_oop())
xtty->object(xn, arg.oop_value());
else {
diff --git a/src/hotspot/src/share/vm/runtime/fprofiler.cpp b/src/hotspot/src/share/vm/runtime/fprofiler.cpp
index 58cb6e89..89aa0cd8 100644
--- a/src/hotspot/src/share/vm/runtime/fprofiler.cpp
+++ b/src/hotspot/src/share/vm/runtime/fprofiler.cpp
@@ -635,7 +635,7 @@ class vmNode : public ProfilerNode {
const char *name() const return _name;
bool is_compiled() const return true;

- bool vm_match(const char* name) const return strcmp(name, _name) == 0;
+ bool vm_match(const char* name) const return name == NULL ? false : strcmp(name, _name) == 0;

Method* method() return NULL;


Then press Ctrl+D twice. You should see:



patching file src/hotspot/src/share/vm/code/dependencies.cpp
patching file src/hotspot/src/share/vm/runtime/fprofiler.cpp


3. Install dependencies.



This may be a bit of a cat-and-mouse game. In my case, I had everything I needed except for libcups2-dev and libasound2-dev.



apt install -y libcups2-dev libasound2-dev



The configure step (next) was amazingly clear about what it thought was missing.



4. Configure



Configure the source tree:



cd src
./configure


If all goes well, the last lines will say something like:



A new configuration has been successfully created in
/home/dacut/projects/corretto-8/src/build/linux-x86_64-normal-server-release
using default settings.

Configuration summary:
* Debug level: release
* JDK variant: normal
* JVM variants: server
* OpenJDK target: OS: linux, CPU architecture: x86, address length: 64

Tools summary:
* Boot JDK: openjdk version "1.8.0_181" OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1ubuntu0.18.04.1-b13) OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode) (at /usr/lib/jvm/java-8-openjdk-amd64)
* Toolchain: gcc (GNU Compiler Collection)
* C Compiler: Version 7.3.0 (at /usr/bin/gcc)
* C++ Compiler: Version 7.3.0 (at /usr/bin/g++)

Build performance summary:
* Cores to use: 7
* Memory limit: 15757 MB


If this was the case, go on!



If not, you'll see an error message. In my case they were quite helpful:



configure: error: Could not find cups! You might be able to fix this by running 'sudo apt-get install libcups2-dev'. 
configure exiting with result code 1

configure: error: Could not find alsa! You might be able to fix this by running 'sudo apt-get install libasound2-dev'.
configure exiting with result code 1


Install what it advises (step 3), then try again. This may take a few iterations since you only get one message per configure run.



5. Compile



Run make. If all goes well, you'll see something like the following at the end:



## Finished jdk (build time 00:02:07)

----- Build times -------
Start 2018-11-24 13:30:24
End 2018-11-24 13:35:36
00:00:19 corba
00:02:18 hotspot
00:00:12 jaxp
00:00:16 jaxws
00:02:07 jdk
00:00:00 langtools
00:05:12 TOTAL
-------------------------
Finished building OpenJDK for target 'default'


If not... well, now you're deep into the experimentation part.



6. Install



sudo make install


You'll now have a Corretto build in /usr/local/jvm/openjdk-1.8.0-internal.



Disclaimer: Although I work for AWS, this is purely my personal experimentation and I'm speaking for myself only. These steps are neither sanctioned nor endorsed by Amazon or the Corretto team. Proceed with caution!







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 24 '18 at 22:18









David CuthbertDavid Cuthbert

53946




53946





















      2














      There's a bit more easy way that rely on the translation of the rpm package to deb package, but you may loose some dependency checks. The tool is called alien.



      apt-get install alien -y


      As of today 2018-11-27, download both the JRE and the JDK rpm from amazon. The JDK rpm depends on the JRE to be installed



      > rpm -qpR java-1.8.0-amazon-corretto-devel-1.8.0_192.b12-1.amzn2.x86_64.rpm
      ...
      java-1.8.0-amazon-corretto(x86-64) = 1:1.8.0_192.b12-1.amzn2
      ...


      Then install both packages the debian way :



      dpkg --install /java-*amd64.deb


      Then link the executables (choose either the JRE or the JDK ones), the above commands expects that PATH environment variable contains /usr/local/bin :



      ln -s /usr/lib/jvm/java-*-amazon-corretto.x86_64/bin/* /usr/local/bin/ #JDK
      ln -s /usr/lib/jvm/java-*-amazon-corretto.x86_64/jre/bin/* /usr/local/bin/ #JRE


      That should be it if you don't need anything fancy, or if the target OS has already the right dependencies already installed. But if not, e.g. the target is a container image, it'll get a bit more nasty to get it right, thanks to the way Debian do things with Java.



      Also make sure the target OS have the right glibc with ldd --version.



      CA Certificates



      The first thing you may need is the central authority certificates - e.g. if the code has to connect to https sites -, since it is not shipped with the java release but part of the OS. Otherwise you'll likely see this exception poping up, indicating that either the cacerts file is not found, empty, or do not have the right ca-certificates.



      javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty


      In the RPM and the generated deb the cacerts file is linked to /etc/pki/java/cacerts which is a somehow regular path on Centos, or on Amazon linux, this file is already there on the default centos docker image, but with Debian or Ubuntu it is not. And you'll likely have to install ca-certificates-java which will install ca-certificates dependency but among others also openjdk-8-jre-headless which is then linked via alternatives and used by default.



      apt-get install ca-certificates-java -y


      This will install a small java program (/etc/ca-certificates/update.d/jks-keystore) that will add each ca-certificate to a newly created JKS keystore called /etc/ssl/certs/java/cacerts. Of course the shell script launching this java program only knows about the jdk that are shipped by Debian...



      If you remove ca-certificates-java and prune unneeded dependencies, make sure this file /etc/ssl/certs/java/cacerts is backed up so you can restore it.



      Then you'll need to replace the JRE cacerts link to the new file, e.g.



      ln -sf /etc/ssl/certs/java/cacerts /usr/lib/jvm/java-1.8.0-amazon-corretto.x86_64/jre/lib/security/cacerts


      Working with images



      If the JVM has to work with images, like generating ones with text, etc. The JVM may likely need additional libraries. I needed to install libfontconfig1 and libx11-6.



      apt-get install ttf-dejavu libfontconfig1 libx11-6 -y


      So it's basically a trial and error. If it is needed to have everything one can inspect the rpm dependencies. Since it's the JRE that declares the most that's likely the one of interest to see if anything is missing.



      rpm -qpR java-1.8.0-amazon-corretto-1.8.0_192.b12-1.amzn2.x86_64.rpm


      This lists libraries in the JRE itself (like libnio.so), but some others might be useful to check like ldconfig -p | grep libz, depending on the setup one may need to be a superuser to run ldconfig.






      share|improve this answer





























        2














        There's a bit more easy way that rely on the translation of the rpm package to deb package, but you may loose some dependency checks. The tool is called alien.



        apt-get install alien -y


        As of today 2018-11-27, download both the JRE and the JDK rpm from amazon. The JDK rpm depends on the JRE to be installed



        > rpm -qpR java-1.8.0-amazon-corretto-devel-1.8.0_192.b12-1.amzn2.x86_64.rpm
        ...
        java-1.8.0-amazon-corretto(x86-64) = 1:1.8.0_192.b12-1.amzn2
        ...


        Then install both packages the debian way :



        dpkg --install /java-*amd64.deb


        Then link the executables (choose either the JRE or the JDK ones), the above commands expects that PATH environment variable contains /usr/local/bin :



        ln -s /usr/lib/jvm/java-*-amazon-corretto.x86_64/bin/* /usr/local/bin/ #JDK
        ln -s /usr/lib/jvm/java-*-amazon-corretto.x86_64/jre/bin/* /usr/local/bin/ #JRE


        That should be it if you don't need anything fancy, or if the target OS has already the right dependencies already installed. But if not, e.g. the target is a container image, it'll get a bit more nasty to get it right, thanks to the way Debian do things with Java.



        Also make sure the target OS have the right glibc with ldd --version.



        CA Certificates



        The first thing you may need is the central authority certificates - e.g. if the code has to connect to https sites -, since it is not shipped with the java release but part of the OS. Otherwise you'll likely see this exception poping up, indicating that either the cacerts file is not found, empty, or do not have the right ca-certificates.



        javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty


        In the RPM and the generated deb the cacerts file is linked to /etc/pki/java/cacerts which is a somehow regular path on Centos, or on Amazon linux, this file is already there on the default centos docker image, but with Debian or Ubuntu it is not. And you'll likely have to install ca-certificates-java which will install ca-certificates dependency but among others also openjdk-8-jre-headless which is then linked via alternatives and used by default.



        apt-get install ca-certificates-java -y


        This will install a small java program (/etc/ca-certificates/update.d/jks-keystore) that will add each ca-certificate to a newly created JKS keystore called /etc/ssl/certs/java/cacerts. Of course the shell script launching this java program only knows about the jdk that are shipped by Debian...



        If you remove ca-certificates-java and prune unneeded dependencies, make sure this file /etc/ssl/certs/java/cacerts is backed up so you can restore it.



        Then you'll need to replace the JRE cacerts link to the new file, e.g.



        ln -sf /etc/ssl/certs/java/cacerts /usr/lib/jvm/java-1.8.0-amazon-corretto.x86_64/jre/lib/security/cacerts


        Working with images



        If the JVM has to work with images, like generating ones with text, etc. The JVM may likely need additional libraries. I needed to install libfontconfig1 and libx11-6.



        apt-get install ttf-dejavu libfontconfig1 libx11-6 -y


        So it's basically a trial and error. If it is needed to have everything one can inspect the rpm dependencies. Since it's the JRE that declares the most that's likely the one of interest to see if anything is missing.



        rpm -qpR java-1.8.0-amazon-corretto-1.8.0_192.b12-1.amzn2.x86_64.rpm


        This lists libraries in the JRE itself (like libnio.so), but some others might be useful to check like ldconfig -p | grep libz, depending on the setup one may need to be a superuser to run ldconfig.






        share|improve this answer



























          2












          2








          2







          There's a bit more easy way that rely on the translation of the rpm package to deb package, but you may loose some dependency checks. The tool is called alien.



          apt-get install alien -y


          As of today 2018-11-27, download both the JRE and the JDK rpm from amazon. The JDK rpm depends on the JRE to be installed



          > rpm -qpR java-1.8.0-amazon-corretto-devel-1.8.0_192.b12-1.amzn2.x86_64.rpm
          ...
          java-1.8.0-amazon-corretto(x86-64) = 1:1.8.0_192.b12-1.amzn2
          ...


          Then install both packages the debian way :



          dpkg --install /java-*amd64.deb


          Then link the executables (choose either the JRE or the JDK ones), the above commands expects that PATH environment variable contains /usr/local/bin :



          ln -s /usr/lib/jvm/java-*-amazon-corretto.x86_64/bin/* /usr/local/bin/ #JDK
          ln -s /usr/lib/jvm/java-*-amazon-corretto.x86_64/jre/bin/* /usr/local/bin/ #JRE


          That should be it if you don't need anything fancy, or if the target OS has already the right dependencies already installed. But if not, e.g. the target is a container image, it'll get a bit more nasty to get it right, thanks to the way Debian do things with Java.



          Also make sure the target OS have the right glibc with ldd --version.



          CA Certificates



          The first thing you may need is the central authority certificates - e.g. if the code has to connect to https sites -, since it is not shipped with the java release but part of the OS. Otherwise you'll likely see this exception poping up, indicating that either the cacerts file is not found, empty, or do not have the right ca-certificates.



          javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty


          In the RPM and the generated deb the cacerts file is linked to /etc/pki/java/cacerts which is a somehow regular path on Centos, or on Amazon linux, this file is already there on the default centos docker image, but with Debian or Ubuntu it is not. And you'll likely have to install ca-certificates-java which will install ca-certificates dependency but among others also openjdk-8-jre-headless which is then linked via alternatives and used by default.



          apt-get install ca-certificates-java -y


          This will install a small java program (/etc/ca-certificates/update.d/jks-keystore) that will add each ca-certificate to a newly created JKS keystore called /etc/ssl/certs/java/cacerts. Of course the shell script launching this java program only knows about the jdk that are shipped by Debian...



          If you remove ca-certificates-java and prune unneeded dependencies, make sure this file /etc/ssl/certs/java/cacerts is backed up so you can restore it.



          Then you'll need to replace the JRE cacerts link to the new file, e.g.



          ln -sf /etc/ssl/certs/java/cacerts /usr/lib/jvm/java-1.8.0-amazon-corretto.x86_64/jre/lib/security/cacerts


          Working with images



          If the JVM has to work with images, like generating ones with text, etc. The JVM may likely need additional libraries. I needed to install libfontconfig1 and libx11-6.



          apt-get install ttf-dejavu libfontconfig1 libx11-6 -y


          So it's basically a trial and error. If it is needed to have everything one can inspect the rpm dependencies. Since it's the JRE that declares the most that's likely the one of interest to see if anything is missing.



          rpm -qpR java-1.8.0-amazon-corretto-1.8.0_192.b12-1.amzn2.x86_64.rpm


          This lists libraries in the JRE itself (like libnio.so), but some others might be useful to check like ldconfig -p | grep libz, depending on the setup one may need to be a superuser to run ldconfig.






          share|improve this answer















          There's a bit more easy way that rely on the translation of the rpm package to deb package, but you may loose some dependency checks. The tool is called alien.



          apt-get install alien -y


          As of today 2018-11-27, download both the JRE and the JDK rpm from amazon. The JDK rpm depends on the JRE to be installed



          > rpm -qpR java-1.8.0-amazon-corretto-devel-1.8.0_192.b12-1.amzn2.x86_64.rpm
          ...
          java-1.8.0-amazon-corretto(x86-64) = 1:1.8.0_192.b12-1.amzn2
          ...


          Then install both packages the debian way :



          dpkg --install /java-*amd64.deb


          Then link the executables (choose either the JRE or the JDK ones), the above commands expects that PATH environment variable contains /usr/local/bin :



          ln -s /usr/lib/jvm/java-*-amazon-corretto.x86_64/bin/* /usr/local/bin/ #JDK
          ln -s /usr/lib/jvm/java-*-amazon-corretto.x86_64/jre/bin/* /usr/local/bin/ #JRE


          That should be it if you don't need anything fancy, or if the target OS has already the right dependencies already installed. But if not, e.g. the target is a container image, it'll get a bit more nasty to get it right, thanks to the way Debian do things with Java.



          Also make sure the target OS have the right glibc with ldd --version.



          CA Certificates



          The first thing you may need is the central authority certificates - e.g. if the code has to connect to https sites -, since it is not shipped with the java release but part of the OS. Otherwise you'll likely see this exception poping up, indicating that either the cacerts file is not found, empty, or do not have the right ca-certificates.



          javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty


          In the RPM and the generated deb the cacerts file is linked to /etc/pki/java/cacerts which is a somehow regular path on Centos, or on Amazon linux, this file is already there on the default centos docker image, but with Debian or Ubuntu it is not. And you'll likely have to install ca-certificates-java which will install ca-certificates dependency but among others also openjdk-8-jre-headless which is then linked via alternatives and used by default.



          apt-get install ca-certificates-java -y


          This will install a small java program (/etc/ca-certificates/update.d/jks-keystore) that will add each ca-certificate to a newly created JKS keystore called /etc/ssl/certs/java/cacerts. Of course the shell script launching this java program only knows about the jdk that are shipped by Debian...



          If you remove ca-certificates-java and prune unneeded dependencies, make sure this file /etc/ssl/certs/java/cacerts is backed up so you can restore it.



          Then you'll need to replace the JRE cacerts link to the new file, e.g.



          ln -sf /etc/ssl/certs/java/cacerts /usr/lib/jvm/java-1.8.0-amazon-corretto.x86_64/jre/lib/security/cacerts


          Working with images



          If the JVM has to work with images, like generating ones with text, etc. The JVM may likely need additional libraries. I needed to install libfontconfig1 and libx11-6.



          apt-get install ttf-dejavu libfontconfig1 libx11-6 -y


          So it's basically a trial and error. If it is needed to have everything one can inspect the rpm dependencies. Since it's the JRE that declares the most that's likely the one of interest to see if anything is missing.



          rpm -qpR java-1.8.0-amazon-corretto-1.8.0_192.b12-1.amzn2.x86_64.rpm


          This lists libraries in the JRE itself (like libnio.so), but some others might be useful to check like ldconfig -p | grep libz, depending on the setup one may need to be a superuser to run ldconfig.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 6 '18 at 17:21

























          answered Nov 27 '18 at 14:45









          BriceBrice

          24.5k56782




          24.5k56782





















              1














              Amazon Corretto preview2 has been released and it includes packages for Debian based systems:



              https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html






              share|improve this answer



























                1














                Amazon Corretto preview2 has been released and it includes packages for Debian based systems:



                https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html






                share|improve this answer

























                  1












                  1








                  1







                  Amazon Corretto preview2 has been released and it includes packages for Debian based systems:



                  https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html






                  share|improve this answer













                  Amazon Corretto preview2 has been released and it includes packages for Debian based systems:



                  https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 15 at 21:38









                  alvdavialvdavi

                  661




                  661













                      Popular posts from this blog

                      Use pre created SQLite database for Android project in kotlin

                      Darth Vader #20

                      Ondo