Tutorial: GNUnet on Debian 9

Introduction

Welcome to the hopefully painless GNUnet tutorial for Debian 9! It provides very concrete instructions on how to compile, install and configure a current version of GNUnet. The goal is to support newcomers, either end users or developers, who want to get in touch with GNUnet for the first time. After installing GNUnet we will make sure that out new GNUnet installation is working correctly.

Attention: If you came across the official gnunet package for Debian 9, ignore it! It is ancient and not compatible with current GNUnet installations.

Now let's start!

Requirements

First let's install the following Debian 9 packages to use GNUnet painlessly. Optional dependencies are listed in Appendix A. They are required for some experimental GNUnet features.

$ sudo apt install git libtool autoconf autopoint libargon2-dev \
build-essential libgcrypt-dev libidn11-dev zlib1g-dev \
libunistring-dev libglpk-dev miniupnpc libextractor-dev \
libjansson-dev libcurl4-gnutls-dev gnutls-bin libsqlite3-dev \
openssl libnss3-tools libopus-dev libpulse-dev libogg-dev \
libsodium-dev

Make an installation directory

Next we create a directory in our home directory where we store the source code later. We should keep this directory after installation because it contains Makefiles that can be used for uninstalling GNUnet again (see chapter *Uninstall GNUnet and its dependencies*).

$ mkdir ~/gnunet_installation

Get the source code

We download the GNUnet source code using git. On Debian 9 we need the sources of another library (libmicrohttpd).

Note: The official libmicrohttpd package for Debian 9 is too old, we need at least version 0.9.52 – that's why we install it from gnunet.org, and not from the package manager.

$ cd ~/gnunet_installation
$ git clone --depth 1 https://gnunet.org/git/gnunet.git
$ git clone --depth 1 https://gnunet.org/git/gnunet-gtk.git
$ git clone --depth 1 https://gnunet.org/git/libmicrohttpd.git

Compile and Install

Before we can compile GNUnet on Debian 9, we compile and install libmicrohttpd.

$ cd ~/gnunet_installation/libmicrohttpd
$ autoreconf -fi
$ sudo apt install libgnutls28-dev
$ ./configure --disable-doc --prefix=/opt/libmicrohttpd
$ make -j$(nproc || echo -n 1)
$ sudo make install

Installing GNUnet is not hard. We have two options: installing a production version and installing a development version. If you want to start writing GNUnet applications or join the GNUnet development choose the development version (it will print more debug output and contains debug symbols that can be displayed with a debugger). Otherwise choose the production version.

Option 1: GNUnet for testing / usage

$ cd ~/gnunet_installation/gnunet
$ ./bootstrap
$ export GNUNET_PREFIX=/usr/local # for example, other locations possible
$ ./configure --prefix=$GNUNET_PREFIX --disable-documentation --with-microhttpd=/opt/libmicrohttpd
$ sudo addgroup gnunet
$ sudo usermod -aG gnunet $USER
$ make -j$(nproc || echo -n 1)
$ sudo make install

Option 2: GNUnet for development

$ cd ~/gnunet_installation/gnunet
$ ./bootstrap
$ export GNUNET_PREFIX=/usr/local # for example, other locations possible
$ export CFLAGS="-g -Wall -O0"
$ ./configure --prefix=$GNUNET_PREFIX --disable-documentation --enable-logging=verbose --with-microhttpd=/opt/libmicrohttpd
$ sudo addgroup gnunet
$ sudo usermod -aG gnunet $USER
$ make -j$(nproc || echo -n 1)
$ sudo make install

In Addition: gnunet-gtk

Installing the Gtk+-based graphical user interface can be done on top of either the production or development installation.

$ sudo apt install libgtk-3-dev libgladeui-dev libunique-dev libqrencode-dev
$ cd ~/gnunet_installation/gnunet-gtk
$ ./bootstrap
$ export GNUNET_PREFIX=/usr/local # for example, other locations possible
$ export CFLAGS="-g -Wall -O0"
$ ./configure --prefix=$GNUNET_PREFIX --with-gnunet=$GNUNET_PREFIX
$ make -j$(nproc || echo -n 1)
$ sudo make install

Since we added our user to the group gnunet, we need to call the following command (or alternatively log out and log in again) to make the membership effective:

$ newgrp

Create configuration file

Congratulations! GNUnet is now installed! Before we start it we need to create a configuration file. By default GNUnet looks in our home directory for the file `~/.config/gnunet.conf`. We can start with an empty file for now:

$ mkdir -p ~/.config
$ touch ~/.config/gnunet.conf

Now we created the configuration file. Please check the handbook for a first minimal configuration. But in general, we dont need to configure anything in particular for now.

To go on, please move over here:

GNUnet

Please head over here: Use!

Uninstall GNUnet and its dependencies

$ cd ~/gnunet_installation/gnunet
$ sudo make uninstall
$ cd ~/gnunet_installation/libmicrohttpd
$ sudo make uninstall
$ sudo apt remove git libtool autoconf autopoint build-essential libgcrypt-dev libidn11-dev zlib1g-dev libunistring-dev libglpk-dev miniupnpc libextractor-dev libjansson-dev libcurl4-gnutls-dev libsqlite3-dev
$ sudo apt autoremove
$ sudo userdel -r gnunet
$ sudo groupdel gnunet