Skip to content

Instantly share code, notes, and snippets.

@justyns
Forked from simbo1905/GnuPG-2.2.md
Last active October 2, 2019 04:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justyns/79e7e8a0750abb609a05fca50956e4a3 to your computer and use it in GitHub Desktop.
Save justyns/79e7e8a0750abb609a05fca50956e4a3 to your computer and use it in GitHub Desktop.
Build/install instructions for GnuPG 2.2.x on Centos 7 and similar distros (formerly for 2.1.x)

GnuPG 2.2.x Build Instructions

Below are my build instructions for GnuPG 2.2.17, released on July 12th, 2018. These instructions are built for a headless Centos 7 LTS server (specificaly the openshift/base-centos7 docker image).

You use the below install script to install GnuPG 2.2.x by running the following commands:

# if you are root in a docker image:
curl -OL "https://gist.githubusercontent.com/justyns/79e7e8a0750abb609a05fca50956e4a3/raw/1ca349eaa93247a18047416a44c05480669f5d86/install-gnupg22.shsh" && bash ./install-gnupg22.sh
#!/bin/bash
# ---------
# Script to build and install GnuPG 2.2.x
set -ex
yum-builddep -y gnupg2
mkdir -p /tmp/gnupg22 && cd /tmp/gnupg22
gpg --list-keys
gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 249B39D24F25E3B6 04376F3EE0856959 2071B08A33BD3F06 8A861B1C7EFD60D9
wget -c https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.36.tar.gz.sig
wget -c https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.36.tar.gz
wget -c https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.5.tar.gz
wget -c https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.5.tar.gz.sig
wget -c https://www.gnupg.org/ftp/gcrypt/libassuan/libassuan-2.5.3.tar.bz2
wget -c https://www.gnupg.org/ftp/gcrypt/libassuan/libassuan-2.5.3.tar.bz2.sig
wget -c https://www.gnupg.org/ftp/gcrypt/libksba/libksba-1.3.5.tar.bz2
wget -c https://www.gnupg.org/ftp/gcrypt/libksba/libksba-1.3.5.tar.bz2.sig
wget -c https://www.gnupg.org/ftp/gcrypt/npth/npth-1.6.tar.bz2
wget -c https://www.gnupg.org/ftp/gcrypt/npth/npth-1.6.tar.bz2.sig
# wget -c https://www.gnupg.org/ftp/gcrypt/pinentry/pinentry-1.1.0.tar.bz2
# wget -c https://www.gnupg.org/ftp/gcrypt/pinentry/pinentry-1.1.0.tar.bz2.sig
wget -c https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.2.17.tar.bz2
wget -c https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.2.17.tar.bz2.sig
gpg --verify libgpg-error-1.36.tar.gz.sig && tar -xzf libgpg-error-1.36.tar.gz
gpg --verify libgcrypt-1.8.5.tar.gz.sig && tar -xzf libgcrypt-1.8.5.tar.gz
gpg --verify libassuan-2.5.3.tar.bz2.sig && tar -xjf libassuan-2.5.3.tar.bz2
gpg --verify libksba-1.3.5.tar.bz2.sig && tar -xjf libksba-1.3.5.tar.bz2
gpg --verify npth-1.6.tar.bz2.sig && tar -xjf npth-1.6.tar.bz2
# gpg --verify pinentry-1.1.0.tar.bz2.sig && tar -xjf pinentry-1.1.0.tar.bz2
gpg --verify gnupg-2.2.17.tar.bz2.sig && tar -xjf gnupg-2.2.17.tar.bz2
cd libgpg-error-1.36/ && ./configure && make && make install && cd ../
cd libgcrypt-1.8.5 && ./configure && make && make install && cd ../
cd libassuan-2.5.3 && ./configure && make && make install && cd ../
cd libksba-1.3.5 && ./configure && make && make install && cd ../
cd npth-1.6 && ./configure && make && make install && cd ../
# cd pinentry-1.1.0 && ./configure --enable-pinentry-curses --disable-pinentry-qt4
# make && make install && cd ../
cd gnupg-2.2.17 && ./configure && make && make install
echo "/usr/local/lib" > /etc/ld.so.conf.d/gpg2.conf && ldconfig -v
# Without the line below, gpg2 might fail to create / import secret keys !!!
if [ -d ~/.gnugp ]; then rm -ri ~/.gnugp; fi
gpgconf --kill gpg-agent
# tidy up
rm -rf cd /tmp/gnupg22
echo "Complete!!!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment