How To Install node-crypto-cacerts on Ubuntu 18.04

In this tutorial we learn how to install node-crypto-cacerts on Ubuntu 18.04. node-crypto-cacerts is updates SSL certificate chain to use a directory of certificates

Introduction

In this tutorial we learn how to install node-crypto-cacerts on Ubuntu 18.04.

What is node-crypto-cacerts

node-crypto-cacerts is:

Node has a set of trusted certificates compiled into it that is uses during SSL/HTTPS negotiations. The list of certificates can be replaced with user-specified certificates during the usage of the https module, but only for that particular https instance.

Sometimes, one need to use libraries that make the HTTPS calls deep within, and cannot modify the code. This module is designed to monkey patch the built-in crypto module and allow you to specify a directory of existing certificates that apply to all HTTPS connections that are made using the underlying crypto module.

Usage:

require(’./crypto-cacerts’).cryptoPatch("/etc/ssl/certs");

This will use all of the certificates in your OpenSSL certificates directory.

Node.js is an event-based server-side JavaScript engine.

There are three methods to install node-crypto-cacerts on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install node-crypto-cacerts Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install node-crypto-cacerts using apt-get by running the following command:

sudo apt-get -y install node-crypto-cacerts

Install node-crypto-cacerts Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install node-crypto-cacerts using apt by running the following command:

sudo apt -y install node-crypto-cacerts

Install node-crypto-cacerts Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install node-crypto-cacerts using aptitude by running the following command:

sudo aptitude -y install node-crypto-cacerts

How To Uninstall node-crypto-cacerts on Ubuntu 18.04

To uninstall only the node-crypto-cacerts package we can use the following command:

sudo apt-get remove node-crypto-cacerts

Uninstall node-crypto-cacerts And Its Dependencies

To uninstall node-crypto-cacerts and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove node-crypto-cacerts

Remove node-crypto-cacerts Configurations and Data

To remove node-crypto-cacerts configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge node-crypto-cacerts

Remove node-crypto-cacerts configuration, data, and all of its dependencies

We can use the following command to remove node-crypto-cacerts configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge node-crypto-cacerts

References

Summary

In this tutorial we learn how to install node-crypto-cacerts package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.