How to Install Root or CA Certificate in Ubuntu

Trusting a custom certificate for the development environment is sometimes beneficial for the team and also sometimes we just have the need to trust (install) a CA or root certificate manually. Here is how we can do it easily in ubuntu systems. We consider here that the name of the certificate that needs to be installed is rootCA.crt

Step 01

Create a directory in /usr/share/ca-certificates/, name of the organization the certificate(s) belong to is a good candidate for naming the directory. In my case, I will just put it in a directory named extra.

sudo mkdir /usr/share/ca-certificates/extra/

Step 02

Now, copy the certificate rootCA.crt into the newly-created directory.

sudo cp rootCA.crt /usr/share/ca-certificates/extra/

Step 03

Reconfigure the ca-certificates configuration by using

sudo dpkg-reconfigure ca-certificates

this will invoke an interactive window to select which certificates to add. Select yes

press (spacebar) the newly copied certificate and then select (tab) ok

This should re-configure the ca-certificates configuration.


Optionally the following command can also be used to avoid interactive prompts. According to man update-ca-certificates the directory location should be /usr/local/share/ca-certificates/ and the file extension must be .crt.

sudo update-ca-certificates


Leave a Comment