How To Update CA Certificate in Linux

Updating CA certificates in Linux is essential for maintaining secure communications. Here’s a step-by-step guide to help you through the process:

For Debian-based Distributions (e.g., Ubuntu)

  1. Copy the CA Certificate:
    • Place your CA certificate file (e.g., my-ca.crt) in the /usr/local/share/ca-certificates/ directory.
    sudo cp my-ca.crt /usr/local/share/ca-certificates/
  2. Update the CA Certificates:
    • Run the update-ca-certificates command to update the CA certificates.
    sudo update-ca-certificates

For Red Hat-based Distributions (e.g., CentOS, Fedora)

  1. Copy the CA Certificate:
    • Place your CA certificate file in the /etc/pki/ca-trust/source/anchors/ directory.
    sudo cp my-ca.crt /etc/pki/ca-trust/source/anchors/
  2. Update the CA Certificates:
    • Run the update-ca-trust command to update the CA certificates.
    sudo update-ca-trust

Verifying the Update

After updating, you can verify that the new CA certificate has been added by checking the contents of the CA certificates file:

cat /etc/ssl/certs/ca-certificates.crt | grep "my-ca"

Leave a Comment