The Tor Project maintains a site which explains how to set up a relay. Usually all you need is to edit the torrc
file. The file resides in /etc/tor/torrc
when you install it via package management.
You need to set ORPort
and ExitPolicy
:
ORPort 9001
ExitPolicy reject *:*
The network uses the ORPort
to contact your Tor relay and the ExitPolicy
above advises to be a middle router (reject all exit connections).
Save the settings and restart the Tor process:
sudo service tor restart
Now look at the log file in /var/log/tor/
. When it shows the following line, all is good:
Self-testing indicates your ORPort is reachable from the outside. Excellent.
If not you might want to do some research at Tor's Q&A page. Furthermore the following site might be interesting: https://blog.torproject.org/blog/tips-running-exit-node-minimal-harassment