How To Install gpg on Debian 11

In this tutorial we learn how to install gpg on Debian 11. gpg is GNU Privacy Guard – minimalist public key operations

Introduction

In this tutorial we learn how to install gpg on Debian 11.

What is gpg

gpg is:

GnuPG is GNU’s tool for secure communication and data storage. It can be used to encrypt data and to create digital signatures. It includes an advanced key management facility and is compliant with the proposed OpenPGP Internet standard as described in RFC4880.

This package contains /usr/bin/gpg itself, and is useful on its own only for public key operations (encryption, signature verification, listing OpenPGP certificates, etc). If you want full capabilities (including secret key operations, network access, etc), please install the “gnupg” package, which pulls in the full suite of tools.

There are three methods to install gpg on Debian 11. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install gpg Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install gpg

Install gpg Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install gpg using apt by running the following command:

sudo apt -y install gpg

Install gpg 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 Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install gpg using aptitude by running the following command:

sudo aptitude -y install gpg

How To Uninstall gpg on Debian 11

To uninstall only the gpg package we can use the following command:

sudo apt-get remove gpg

Uninstall gpg And Its Dependencies

To uninstall gpg and its dependencies that are no longer needed by Debian 11, we can use the command below:

sudo apt-get -y autoremove gpg

Remove gpg Configurations and Data

To remove gpg configuration and data from Debian 11 we can use the following command:

sudo apt-get -y purge gpg

Remove gpg configuration, data, and all of its dependencies

We can use the following command to remove gpg configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge gpg

Dependencies

gpg have the following dependencies:

References

Summary

In this tutorial we learn how to install gpg package on Debian 11 using different package management tools: apt, apt-get and aptitude.