Embarking on a Tor Relay Server Setup can feel complex at first, but this guide will simplify the process from start to finish. By following these steps on Ubuntu 24.04 or Debian 12, you’ll transform your server into a reliable non-exit relay—bolstering the network’s capacity and helping maintain online anonymity for countless users worldwide.
Preparing Your System for a Secure Tor Environment
Begin by ensuring your server is up-to-date and equipped with all the necessary packages and security patches before configuring your Tor relay node.sudo apt update && sudo apt upgrade -y
Installing Tor and Essential Dependencies
Leverage the official repositories to install Tor and its dependencies. This forms the foundation of your future middle relay configuration, ensuring compatibility and simplified maintenance.sudo apt install tor -y
Configuring a Non-Exit Tor Relay Node
Edit the torrc
:sudo nano /etc/tor/torrc
Include settings that define your relay as a non-exit middle node:Nickname MySecureNonExitRelay
ORPort 9001
SocksPort 0
ContactInfo [email protected]
ExitRelay 0
ExitPolicy reject *:*
Log notice file /var/log/tor/notices.log
These parameters ensure your server acts strictly as a forwarder within the Tor network, enhancing anonymity without serving as an exit point.
Verifying and Launching Your Middle Relay Configuration
Before running your new Tor instance, verify the configuration:sudo tor --verify-config -f /etc/tor/torrc
Now start the instance:sudo systemctl start tor
systemctl status [email protected]
Ensuring Tor Starts Automatically at Boot
By default, the template-based Tor instances do not include a [Install]
section, making it impossible to simply run systemctl enable
on them. To have your [email protected]
instance start automatically after reboot, you can create an override configuration file that adds this functionality.
- Create a Directory for the Override File:
Make sure the directory for the override configuration exists:sudo mkdir -p /etc/systemd/system/[email protected]/
- Create the Override Configuration:
Create the file/etc/systemd/system/[email protected]/override.conf
and add the following content:[Unit] Description=Tor instance: %i
[Service] # Add any custom service tweaks here if needed
[Install] WantedBy=multi-user.target
This[Install]
section instructs systemd that this unit should be enabled to start on boot. - Reload Systemd Daemon:
After creating or modifying unit files, reload the systemd configuration:sudo systemctl daemon-reload
- Enable the Tor Instance:
Now that the override configuration is in place, you can enable the instance:sudo systemctl enable [email protected]
Once completed, [email protected]
will automatically start whenever the system is rebooted, ensuring that your Tor relay runs continuously without manual intervention.
Monitoring and Troubleshooting Your Non-Exit Relay
Use journalctl
to monitor logs and ensure your relay operates smoothly:journalctl -u [email protected] -f
If you encounter issues, these logs will guide you in making necessary adjustments to keep your node stable and reliable.
Conclusion
You’ve successfully completed your Tor Relay Server Setup, transforming your Ubuntu 24.04 or Debian 12 machine into a non-exit relay that supports the wider Tor ecosystem. By contributing bandwidth and reliability, you help maintain a network dedicated to preserving user privacy and freedom online.