I downloaded the latest stable tarball from https://www.gnupg.org/download/ and extracted it to a folder on my ubuntu machine.
I had to chmod 775 configure in order to be able to run it, then I ran ./configure
I got this message right at the end:
GnuPG v2.0.29 has been configured as follows:
Revision: 120fc69 (4623)
Platform: GNU/Linux (x86_64-unknown-linux-gnu)
OpenPGP: yes
S/MIME: yes
Agent: yes
Smartcard: yes (without internal CCID driver)
Gpgtar: no
Protect tool: (default)
Default agent: (default)
Default pinentry: (default)
Default scdaemon: (default)
Default dirmngr: (default)
Warning: Mismatches between the target platform and the
to be used libraries have been detected for:
libgpg-error libgcrypt
Please check above for more warning messages.
I tried to run a sudo apt-get install libgpg-error libgcrypt but it said they couldn't be found, so I tried libgpg-error-dev libgcrypt-dev and got this:
Reading package lists...
Building dependency tree...
Reading state information...
libgpg-error-dev is already the newest version.
libgcrypt11-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 69 not upgraded.
So I tried to run make and this is what I saw at the very end
Making all in .
make[3]: Entering directory `/home/nitrous/gnupg-new/tests'
srcdir=. GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C GPGSM=../sm/gpgsm ./runtest ./inittests
make[3]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[2]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[1]: Leaving directory `/home/nitrous/gnupg-new'
/bin/bash: ./runtest: permission denied
make[3]: *** [inittests.stamp] Error 126
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Making all in .
make[3]: Entering directory `/home/nitrous/gnupg-new/tests'
srcdir=. GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C GPGSM=../sm/gpgsm ./runtest ./inittests
/bin/bash: ./runtest: Permission denied
make[3]: *** [inittests.stamp] Error 126
make[3]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/nitrous/gnupg-new'
make: *** [all] Error 2
I then ran make install and got the same error at the end. What is going wrong?
Edit:
I've manually compiled and installed libgpg-error and libgcrypt, the ./configure went fine without any warnings, when I ran sudo make
I got this at the end:
chmod 755 ./gpg_dearmor
./gpg_dearmor > ./pubring.gpg < ./pubring.asc
../../g10/gpg2: error while loading shared libraries: libgcrypt.so.20: cannot open shared object file: No such file or directory
make[3]: *** [pubring.gpg] Error 127
make[3]: Leaving directory `/home/nitrous/gnupg-new/tests/openpgp'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/nitrous/gnupg-new'
make: *** [all] Error 2
Then when I tried make install again, I got this:
Making install in tests
make[1]: Entering directory `/home/nitrous/gnupg-new/tests'
Making install in openpgp
make[2]: Entering directory `/home/nitrous/gnupg-new/tests/openpgp'
./gpg_dearmor > ./secring.gpg < ./secring.asc
../../g10/gpg2: error while loading shared libraries: libgcrypt.so.20: cannot open shared object file: No such file or directory
make[2]: *** [secring.gpg] Error 127
make[2]: Leaving directory `/home/nitrous/gnupg-new/tests/openpgp'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/nitrous/gnupg-new/tests'
make: *** [install-recursive] Error 1
Edit 2:
I found a post that said to run sudo ldconfig -v
And then when I ran ./configure
and sudo make install
again I was given this error at the end:
Making all in .
make[3]: Entering directory `/home/nitrous/gnupg-new/tests'
srcdir=. GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C GPGSM=../sm/gpgsm ./runtest ./inittests
/bin/bash: ./runtest: Permission denied
make[3]: *** [inittests.stamp] Error 126
make[3]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/nitrous/gnupg-new'
make: *** [all] Error 2
Edit 3:
I ran a sudo chmod 755 on tests/runtest
and did ./configure
and sudo make
AGAIN and now I have this error:
Making all in .
make[3]: Entering directory `/home/nitrous/gnupg-new/tests'
srcdir=. GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C GPGSM=../sm/gpgsm ./runtest ./inittests
asschk: interpreter: invalid statement `set'
make[3]: *** [inittests.stamp] Error 1
make[3]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/nitrous/gnupg-new/tests'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/nitrous/gnupg-new'
make: *** [all] Error 2
Sigh….
Best Answer
I have found the provided speedo method the easiest for gnupg-2.1.X:
sudo apt-get update
sudo apt-get install libldap2-dev gtk+-2 libbz2-dev
after unpacking the latest gnupg-2.1.X tarball and cd to the new folder, run the command:
sudo ldconfig
download the latest pinentry-0.9.5, run
./configure && make && sudo make install
.test it out:
gpg2 --version
****I would like to update this answer for GnuPG v2.2.x. The following bash file will install on Ubuntu 16.04, 17.10:
This will support TOFU and Smart Cards like Yubikey 4 Nano. To update to the newest version edit version=gnupg-2.2.2 Test it: gpg --version