Installing a Tor Relay from Source on a Raspberry Pi

The other day I learned on Twitter that I should update the Tor relay software on my Raspberry Pi as the Tor project had introduced a new Bridge Authority. So I lazily ran sudo apt-get update  followed by sudo apt-get upgrade only to notice that no new version of the tor package was available via the package manager. Bummer.

Waiting for the package manager to provide a new version seemed futile so I decided to build Tor from scratch. I found a very helpful answer on StackOverflow that listed all the steps required  for my setup.

  1. Make sure to have all dependencies needed for compiling the sources:
  2. Clone Tor from git.torproject.org:
  3. Switch to the latest release branch:
  4. Run  ./autogen.sh
  5. Run  ./configure  or  ./configure --disable-asciidoc  if you don’t want to build the manpages.
  6. Run  make
  7. (Optional): run  make install

This last step installed the new tor binary in /usr/local/bin/ whereas the existing tor binary was still located in /usr/bin/ from where it was picked up by /etc/init.d/tor (I want to run my tor relay as a service whenever the Raspberry reboots). Luckily, this problem had been solved by someone else who shared his findings on a mailing list.

  1. If you’re using service tor {start, stop, reload, etc.}:
  2. The latter will likely point to /usr/bin/tor, which might be outdated.
    If that’s the case, change that line in /etc/init.d/tor to point to the new Tor executable /usr/local/bin/tor – that’s where it should be; if you don’t like that, change BINDIR = /usr/local/bin  in Tor’s Makefile and make install  again.
  3. The Debian Tor packages seem to like to assume torrc will be placed in /etc/tor/torrc . If that’s where your torrc resides, make a symlink to it from /usr/local/etc/tor , which is where the new Tor executable will look for it:
  4. Stop the running tor service:
  5. Reload the tor daemon:
  6. Restart the tor service:

About the author

Uwe

Software developer with experience in Java, JavaFX, EMF, OSGi, and a little bit of Swift. I live and work in Munich.

I use this website mainly as a journal and personal knowledge data base.

My PGP key is here. There are other keys listed for me, but I use this one exclusively.

Fingerprint: 232F 05C4 01BE F43D 0434 0A8A 4ED3 5720 477E EF40

View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *