How to change the default GnuPG version from gpg to gpg2

Posted Over 9 years ago. Visible to the public.

From the GnuPG manual Show archive.org snapshot :

In contrast to the standalone version gpg, which is more suited for server and embedded platforms, this version is commonly installed under the name gpg2 and more targeted to the desktop as it requires several other modules to be installed.

Do the following if you want the gpg command to invoke /usr/bin/gpg2:

$ sudo mv /usr/bin/gpg /usr/bin/gpg1
$ sudo update-alternatives --verbose --install /usr/bin/gpg gnupg /usr/bin/gpg2 50

Note: Whenever gnupg is updated, the /usr/bin/gpg symbolic link will get replaced by gpg from the new package. This will revert the default to gpg. In order to switch the default to gpg2 after an update, do the following:

$ sudo mv /usr/bin/gpg1 /usr/bin/gpg1_deleteMe
$ sudo mv /usr/bin/gpg /usr/bin/gpg1
$ sudo ln -s /usr/bin/gpg2 /usr/bin/gpg
aslamK
Last edit
Almost 6 years ago
aslamK
Tags