How to run a Tor Relay on Ubuntu or Debian

By | 2013/04/07

Here is a quick how-to for setting up a Tor relay on Ubuntu or Debian Linux!

1. First, add the tor repository:

$ sudo nano /etc/apt/sources.list

Add a line as follows, changing the distro name to your current distro.

deb lucid main

2. Next add the gpg keys as follows with these commands:

$ gpg --keyserver --recv 886DDD89

$ gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -

3. Next:

$ sudo apt-get update

This keeps the tor project key updated:

$ sudo apt-get install

And finally install tor:

$ sudo apt-get install tor

4. Upon installing tor, it starts immediately. First stop tor so we can make some changes.

$ sudo /etc/init.d/tor stop

Edit the tor config file:

$ sudo nano /etc/tor/torrc

Uncomment and set the following options in that config file:

ORPort 9001

Address yourpublicipaddress

Nickname pickagoodnickname

RelayBandwidthRate 100 KB  # Throttle traffic to 100KB/s (800Kbps)
RelayBandwidthBurst 200 KB # But allow bursts up to 200KB/s (1600Kbps)

ExitPolicy reject *:* # no exits allowed

You may wish to increase or decrease the bandwidth settings as desired.

5. Now that the file has been saved, start tor with:

$ sudo /etc/init.d/tor start

Open up port 9001 in ufw:

$ sudo ufw allow 9001

And finally tail the tor log to make sure all looks ok:

$ tail -f /var/log/tor/log

Note that it can take an hour or so for the relay node to be published.


2 thoughts on “How to run a Tor Relay on Ubuntu or Debian

  1. sayhello

    ufw allow 9001 unknown command in my promt-line.

    but may be firewall dont install on default in debian os

    1. Scott Miller Post author


      sudo apt-get install ufw

Leave a Reply

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

Notify me of followup comments via e-mail. You can also subscribe without commenting.