I need to install a local SSL certificate so that the browser trusts it. The tutorial Running Angular CLI over HTTPS with a Trusted Certificate has instructions for OS X and Windows, but not Ubuntu.

For example these are the instructions for OS X:

  1. Double click on the certificate (server.crt)
  2. Select your desired keychain (login should suffice)
  3. Add the certificate
  4. Open Keychain Access if it isn’t already open
  5. Select the keychain you chose earlier
  6. You should see the certificate localhost
  7. Double click on the certificate
  8. Expand Trust
  9. Select the option Always Trust in "When using this certificate"
  10. Close the certificate window

The certificate is now installed.

What would the equivalent be for Ubuntu?


1 Answer 1


This will do the trick: How do I install a root certificate?

Also these explanations are about a self-signing certificate and not about a CA (certificate Authority)on a server Apache!

To install openssl:

apt-get install openssl

To generate the private key:

openssl genrsa -aes256 -out certificat.key 4096

We rename the key :

mv certificat.key certificat.key.lock

Then generate our unlocked certificate:

openssl rsa -in certificat.key.lock -out certificat.key

Private key unlocked : certificat.key

Locked private key : certificat.key.lock

Generation of the signature request file:

openssl req -new -key certificat.key.lock -out certificat.csr

To auto-sign your certificate:

openssl x509 -req -days 365 -in certificat.csr -signkey certificat.key.lock -out certificat.crt

With Apache:

a2enmod ssl

<VirtualHost *:80>
    ServerName      tuto.myaddrsite.com
    # Redirect HTTP port to HTTPS port
    Redirect        / https://www.myaddrsite.com
<VirtualHost *:443>
    ServerName      tuto.myaddrsite.com
    DocumentRoot    /var/www/tuto

    SSLEngine on
    SSLCertificateFile    /etc/ssl/www/certificat.crt
    SSLCertificateKeyFile /etc/ssl/www/certificat.key
    SSLProtocol all -SSLv2 -SSLv3
    SSLHonorCipherOrder on

To activate vHost :

a2ensite tuto.conf

service apache2 restart

After that, I don't know how to proceed with Angular. My description is for Apache, but you always could find some interesting descritption by simple search on your browser. Or maybe somebody will coming to complete my description :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.