Chapter 14. Headless mode

gtk-gnutella has a configuration called "headless". This configuration doesn't use either GTK1 or GTK2. It will operate without the X Window System. Due to abscence of a GUI it uses even less resources - CPU and memory. This mode is mostly useful for ultrapeers.

See the chapter on getting gtk-gnutella on how to get the source code. The following "build.sh" invocation will produce a headless version of gtk-gnutella.


./build.sh --topless [...]

Run "build.sh" and "make" in the source directory. After compiling, the gtk-gnutella binary is in the "src" subdirectory. Rename the gtk-gnutella binary to gtk-gnutella-headless and copy it to a directory in your PATH, for example, /usr/local/bin.

Assuming you have run a graphical version of gtk-gnutella, copy all files in $HOME/.gtk-gnutella to a backup directory. Run the graphical gtk-gnutella and configure the networking parameters for the "headless" version. You may wish to let it run for a while to verify that it is operating well. Make sure you change the listening port. Exit the graphical gtk-gnutella.

Now, you move the configuration directory for use by the headless gtk-gnutella:


 mv -i ~/.gtk-gnutella ~/.gtk-gnutella-headless

Note that you should not copy the file "config_gnet" directly. However, if you do so, delete the lines containing "guid" and "servent_kuid". These IDs have to be globally unique and must therefore not be shared by two running peers at the same time. Thus, delete these lines so that gtk-gnutella generates new IDs on startup. Using grep to copy any but the mentioned lines is another possibility:


 grep -Ev '^(guid|servent_kuid)' ~/.gtk-gnutella/config_gnet


#! /bin/sh

GTK_GNUTELLA_DIR=~/.gtk-gnutella-headless
export GTK_GNUTELLA_DIR
gtk-gnutella-headless --daemonize --log-stderr ~/tmp/error.log

You can name this script "gtkg-headless" and invoke it like this "gtkg-headless". You can then use the GnutellaNet working area in the graphical gtk-gnutella to connect to this headless ultrapeer, using "127.0.0.1:port".

gtk-gnutella development hosted bySourceForge.net Logo