How to Install a Root Certificate?

How do you add a Certificate Authority (CA) to Ubuntu and RHEL?

When Ubuntu / RHEL packaged Java is used, the described mechanism takes care that the certificate is added to Java trust store too. In addition, added certificates are not lost when Java version is updated.

Ubuntu 18.04 / 20.04

Java's default trust store: /etc/ssl/certs/java/cacerts

  • Copy the .crt file (PEM) into the /usr/local/share/ca-certificates folder.

  • Run sudo update-ca-certificates.

RHEL 7 / 8

Java's default trust store: /etc/pki/java/cacerts

  • Copy the .crt file (PEM or DER) into the /etc/pki/ca-trust/source/anchors folder.

  • Run sudo update-ca-trust extract.