62 lines
1.4 KiB
Markdown
62 lines
1.4 KiB
Markdown
---
|
|
page-title: "How do I install a root certificate? - Ask Ubuntu"
|
|
url: https://askubuntu.com/questions/73287/how-do-i-install-a-root-certificate
|
|
date: "2023-03-30 16:38:30"
|
|
---
|
|
|
|
[
|
|
|
|

|
|
|
|
](https://askubuntu.com/users/31155/sparky1)
|
|
|
|
4
|
|
|
|
Given a CA certificate file `foo.crt`, follow these steps to install it on Ubuntu:
|
|
|
|
1. Create a directory for extra CA certificates in `/usr/local/share/ca-certificates`:
|
|
|
|
```
|
|
sudo mkdir /usr/local/share/ca-certificates/extra
|
|
```
|
|
|
|
2. Copy the CA `.crt` file to this directory:
|
|
|
|
```
|
|
sudo cp foo.crt /usr/local/share/ca-certificates/extra/foo.crt
|
|
```
|
|
|
|
3. Let Ubuntu add the `.crt` file's path relative to `/usr/local/share/ca-certificates` to `/etc/ca-certificates.conf`:
|
|
|
|
```
|
|
sudo dpkg-reconfigure ca-certificates
|
|
```
|
|
|
|
To do this non-interactively, run:
|
|
|
|
```
|
|
sudo update-ca-certificates
|
|
```
|
|
|
|
|
|
In case of a `.pem` file on Ubuntu, it must first be converted to a `.crt` file:
|
|
|
|
```
|
|
openssl x509 -in foo.pem -inform PEM -out foo.crt
|
|
```
|
|
|
|
Or a `.cer` file can be converted to a `.crt` file:
|
|
|
|
```
|
|
openssl x509 -inform DER -in foo.cer -out foo.crt
|
|
```
|
|
|
|
[
|
|
|
|

|
|
|
|
](https://askubuntu.com/users/618353/beastofcaerbannog)
|
|
|
|
answered Jan 12, 2012 at 12:37
|
|
|