credit to: Scott Miller
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 http://deb.torproject.org/torproject.org lucid main
2. Next add the gpg keys as follows with these commands:
$ gpg --keyserver keys.gnupg.net --recv 886DDD89 $ gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
$ sudo apt-get update
This keeps the tor project key updated:
$ sudo apt-get install deb.torproject.org-keyring
And finally 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.