Running a Tor Relay in 2021
Requirements:
- Instance of Debian — use a Virtual Machine for testing, buy a dedicated resource for production.
- About an hour of set up time
We start with getting an instance of Debian up and running. A default build will be fine for now.
If you’re not sure how to set up a Virtual Machine or procure a dedicated instance, running a TOR relay probably isn’t for you. Read up server deployment. Read up on networking and understand the OSI model to get to grips with fundamentals.
Once your environment is ready, we need do three things
- 1. Install TOR
On your new instance of Debian, open up Terminal and run these commands.
sudo apt-get install tor
- 2. Edit our configuration file
Here we will edit our config file to have a contact name — this is important to fill in as it will help you deal with DMCA and abuse alerts. First — open up the configuration file using [sudo vi /etc/tor/torrc] and then edit the file.
You should read through this file to understand what each line does, the bits we need to edit are all the way at the bottom so scroll down as normal
Debian uses Vi to edit files and if your used to Windows it works nothing like Notepad. Press I to go into “Insert Mode” — Press “Esc” to go into command mode.
Insert Mode commands.
i Enter text entry mode
x Delete a character
dd Delete a line
r Replace a character
R Overwrite text, press <Esc> to end
Edit the file as per below.
ORPort 443
Exitpolicy reject *:*
Nickname [tor relay name]
ContactInfo email@website.com
Go back into Command Mode and exit Vi + save your changes
Exiting Vi Commands
ZZ Write (if there were changes), then quit
:wq Write, then quit
:q Quit (will only work if file has not been changed)
:q! Quit without saving changes to file
Then, once you’ve edited your config file, run “tor” to start the service. If you get any errors in this output go back a step, check the error. It’s usually an issue with the config file or a port is in use. The logs will tell you everything.
- 3. Install Nyx to monitor our relay
TOR is up and running. Now we need to set up some monitoring. Run this command.
sudo apt-get install nyx
After install, run sudo nyx
That’s it! Your TOR relay will take some time to be fully integrated after 68 days into the network. You can set up even more TOR relays & exit nodes to help strengthen the network.