Originally published by Robert Beisert at fortcollinsprogram.robert-beisert.com

Installing GNUTLS: A Guide for the Rest of Us

The next few posts will relate to gnutls, an Open Source library designed to form encrypted SSL/TLS connections (similar to OpenSSL, but with more open licenses). The library does not have the best documentation, so this will largely serve as an example of useful techniques and processes for working with such code.


Before we begin, you will need a basic knowledge of Linux, C, and the apt package manager.

That said, the following commands should get you all the basic prerequisites for quick and easy installation:

First, we update the repos, as always:

sudo apt-get update

Then comes the installation process (this is a script – you’ll want to save it to a file and give it chmod +x):

#! /bin/sh

#Gnutls 3.4.* use nettle as the encryption library - replaces gcrypt

sudo apt-get install nettle-dev libgmp-dev -y

#These are important libraries - we can also get pcks11 and libidn_, but they're not necessary

#TrouSers is a TLS library used by GNUTLS

sudo apt-get install guile-2.0-dev trousers libtasn1* -y

#These are important for the installation process and debugging/tests

sudo apt-get install autogen valgrind doxygen -y

Once that’s done, download and extract the stable version of 3.4.x from http://www.gnutls.org/download.html


Now we need to configure and run automake (time consuming…). Because we’ll be leaning on the openssl compatability library for a while, let’s make sure that the configuration pulls it in:

cd <extracted directory>

./configure --enable-openssl-compatibility

make check install

This will build the libraries (so long as you have all the dependency packages we installed earlier, gcc, and the standard libraries) and install them (make them readily accessible). Not only does this give us the current version of the tools, but we get the libraries and headers, too.

So long as you didn’t encounter any errors, you’re all ready to go. It’s very important that we perform the installation using these steps and not directly from apt-get, because the current repositories contain 3.3.x, which we have no useful documentation for.

Tool Citation

Almost 100% of the resources and questions online relate directly to the tools installed by gnutls. They will not be the focus of our exploration into this library.

photo by: