Tutorial: GNUnet on OpenWrt
Installation
To run GNUnet in a meaningful way, you will need a system with at least 16MB of flash storage and at least 64MB of RAM (128MB of more recommended).
OpenWrt ships with up-to-date packages of GNUnet, so you can install it right from the OpenWrt packages repository without having to build things from source by yourself.
GNUnet has been split into a high number of small packages, allowing to select anything between the most simple setup supporting GNS and gnunet-vpn:
root@OpenWrt:/# opkg update
...
root@OpenWrt:/# opkg install gnunet gnunet-gns-flat gnunet-peerstore-flat gnunet-vpn gnunet-transport-tcp gnunet-transport-http_client
...and a full blown GNUnet node for filesharing:
First of all, setup an external (USB, ...) storage volume to contain GNUnet's databases, see OpenWrt's user guide: Fstab Configuration.
Then install PostgreSQL:
root@OpenWrt:/# opkg update
...
root@OpenWrt:/# opkg install pgsql-server pgsql-cli
...
Now configure PGDATA directory in /etc/config/postgresql to be located on your external storage volume. When restarting the postgresql init.d service you should see the new database directory being initialized.
Then install GNUnet itself:
root@OpenWrt:/# opkg install gnunet gnunet-dhtcache-pgsql gnunet-fs-pgsql gnunet-gns-pgsql gnunet-peerstore-flat gnunet-vpn gnunet-transport-tcp gnunet-transport-http_client
Congrats! GNUnet is now installed!
Alternatively you can also use the OpenWrt ImageBuilder to generate ready-made images with those packages pre-installed.
Configuration
GNUnet's configuration is contained in OpenWrt's UCI by a simple translation
mechanism overlaying options set in UCI on GNUnet's default configuration.
In this way, only the options changed by the user are persistent in UCI.
Example:
root@OpenWrt:/# uci show gnunet
gnunet.nse=gnunet-config
gnunet.nse.WORKDELAY='500 ms'
gnunet.dhtcache=gnunet-config
gnunet.dhtcache.DATABASE='postgres'
gnunet.datastore=gnunet-config
gnunet.datastore.DATABASE='postgres'
gnunet.namestore=gnunet-config
gnunet.namestore.DATABASE='postgres'
gnunet.namecache=gnunet-config
gnunet.namecache.DATABASE='postgres'
gnunet.peerstore=gnunet-config
gnunet.peerstore.DATABASE='flat'
gnunet.peerstore_flat=gnunet-config
gnunet.peerstore_flat.FILENAME='/etc/gnunet/peerstore.flat'
gnunet.psycstore=gnunet-config
gnunet.psycstore.DATABASE='postgres'
root@OpenWrt:/# uci set gnunet.peerstore_flat.FILENAME='/mnt/sda1/gnunet/peerstore.flat'
root@OpenWrt:/# uci commit gnunet
Use
OpenWrt's procd runs the gnunet-arm service manager which then runs GNUnet services. We can list them with the -I option:
root@OpenWrt:/etc# gnunet-arm -I
Services (excluding stopped services):
(started: 24 / stopped: 14 / finished: 1)
ats (binary='gnunet-service-ats', status=started)
cadet (binary='gnunet-service-cadet', status=started)
core (binary='gnunet-service-core', status=started)
datastore (binary='gnunet-service-datastore', status=started)
dht (binary='gnunet-service-dht', status=started)
fs (binary='gnunet-service-fs', status=started)
gns (binary='gnunet-service-gns', status=started)
hostlist (binary='gnunet-daemon-hostlist', status=started)
namecache (binary='gnunet-service-namecache', status=started)
namestore (binary='gnunet-service-namestore', status=started)
nat (binary='gnunet-service-nat', status=started)
nse (binary='gnunet-service-nse', status=started)
peerinfo (binary='gnunet-service-peerinfo', status=started)
peerstore (binary='gnunet-service-peerstore', status=started)
resolver (binary='gnunet-service-resolver', status=started)
rest (binary='gnunet-rest-server', status=started)
revocation (binary='gnunet-service-revocation', status=started)
rps (binary='gnunet-service-rps', status=started)
set (binary='gnunet-service-set', status=started)
statistics (binary='gnunet-service-statistics', status=started)
topology (binary='gnunet-daemon-topology', status=started)
transport (binary='gnunet-service-transport', status=started)
vpn (binary='gnunet-service-vpn', status=started)
zonemaster (binary='gnunet-service-zonemaster', status=started)
zonemaster-monitor (binary='gnunet-service-zonemaster-monitor', status=finished)
Make sure, it works!
Please head over here: Use!