Tutorial: GNUnet on Archlinux/Pi

Welcome to this GNUnet tutorial for Archlinux on a Raspberry Pi 3. If you want to run a GNUnet node on a separte system, permanently online, with low energy consumption, this might be the thing for you. This tutorial shows you how to install, run, and operate it.

Requirements

First you need the hardware. This tutorial works with a Raspberry Pi 3. The other Pi versions I haven't tested, but they should probably work, too. To install Archlinux on the Pi3, follow the instructions from archlinuxarm.org.

That was easy, right? Our goal now is to build GNUnet from source. So, let's install the tools for building new software.

> sudo pacman -S base-devel

Now we can continue to install the following Archlinux dependencies to compile GNUnet on our Pi.

$ pacman -Su libmicrohttpd libgcrypt gnurl libunistring gnutls libidn libextractor openssl libltdl sqlite texinfo which gettext zlib pkg-config git miniupnpc libextractor jansson nim

Get the Source Code

We are getting closer. Download the GNUnet source code which we will build in the next step:

> git clone https://gnunet.org/git/gnunet.git

Now it's time to compile GNUnet.

> cd gnunet
> ./bootstrap # Run this to generate the configure files.
> ./configure # Use --help to see the various flags available to you.
> make -j$(nproc || echo -n 1)
> sudo make install

Congrats! GNUnet is now installed!

Run

By default GNUnet looks in our home directory for the file ~/.gnunet/gnunet.conf. We can start with an empty file for now:

> touch ~/.config/gnunet.conf


It's reccomended that you increase your bandwidth restrictions from the acutely low defaults. The example below sets the WAN and LAN limits to the value "unlimited".


$ gnunet-config -s ats -o WAN_QUOTA_IN -V unlimited
$ gnunet-config -s ats -o WAN_QUOTA_OUT -V unlimited
$ gnunet-config -s ats -o LAN_QUOTA_IN -V unlimited
$ gnunet-config -s ats -o LAN_QUOTA_OUT -V unlimited

Now we can start it with the commandline tool gnunet-arm (Automatic Restart Manager).

> gnunet-arm -s

It starts the default GNUnet services. We can list them with the -I option:

> gnunet-arm -I
Running services:
ats (gnunet-service-ats)
revocation (gnunet-service-revocation)
set (gnunet-service-set)
nat (gnunet-service-nat)
transport (gnunet-service-transport)
peerstore (gnunet-service-peerstore)
hostlist (gnunet-daemon-hostlist)
identity (gnunet-service-identity)
namecache (gnunet-service-namecache)
peerinfo (gnunet-service-peerinfo)
datastore (gnunet-service-datastore)
zonemaster (gnunet-service-zonemaster)
zonemaster-monitor (gnunet-service-zonemaster-monitor)
nse (gnunet-service-nse)
cadet (gnunet-service-cadet)
dht (gnunet-service-dht)
core (gnunet-service-core)
gns (gnunet-service-gns)
statistics (gnunet-service-statistics)
topology (gnunet-daemon-topology)
fs (gnunet-service-fs)
namestore (gnunet-service-namestore)
vpn (gnunet-service-vpn)

For stopping GNUnet again we can use the -e option.

> gnunet-arm -e

Make sure, it works!

After starting GNUnet you should make sure that your peer is connecting to the P2P-network. By typing gnunet-core you should see something like this:

> gnunet-core
Tue Oct 30 19:58:48 2018: connection established DSTJ (timeout in 293 s)
Tue Oct 30 19:58:48 2018: connection established A4MK (timeout in 292 s)
Tue Oct 30 19:58:48 2018: connection established 7WRD (timeout in 299 s)
Tue Oct 30 19:58:48 2018: connection established 5WBG (timeout in 299 s)

Chat the cat

To be able to chat, we need to install and compile additional software.

> git clone https://gnunet.org/git/gnunet-nim.git
> cd gnunet-nim/examples
> nim c groupchat.nim

Fine! We can now try to enter a chat server running on another GNUnet node.

> LD_LIBRARY_PATH=/path/to/gnunetlibs ./groupchat --config=/path/to/gnunet.conf --server=YV6G9EP9K3X41BM3FJ3D29BDZR6358XNZ6KDZVV7DFW729YB0KCG --port=welcome --nick=YOURNICK

You should now see something like this:

> 2018-10-30 19:50:10 Welcome 8Q2T! participants: @[]
Hello GNUnet!
2018-10-30 19:52:53 [8Q2T] Hello GNUnet!

Here we have typed "Hello gnunet!" to standard in which is then written out to standard out after having been sent back from GNUnet.