Setting Up the Tor Package Repository on Debian-Based Systems
Setting Up the Tor Package Repository on Debian-Based Systems
Enabling the Tor package repository on Debian and Debian-based distributions, such as Ubuntu, can help ensure you receive the latest updates directly from the Tor project. Follow the steps below to set up and install the Tor package securely on your system.
Important: The #
symbol denotes commands that should be run as the root user or with sudo
privileges.
Step 1: Verify Your CPU Architecture
To ensure compatibility, confirm your CPU architecture supports the Tor package binaries. The repository offers binaries for amd64
, arm64
, and i386
. Run the following command to check your system’s architecture:
# dpkg --print-architecture
Expected outputs should be either amd64
, arm64
, or i386
. Note that 32-bit ARM (armhf
) is not yet supported directly by the Tor project repository, so users with that architecture should install Tor from Debian’s repositories or build it from source.
Step 2: Install apt-transport-https
To securely access Tor’s repository over HTTPS, install apt-transport-https
, which is required for secure connections:
# apt install apt-transport-https
Step 3: Configure the Tor Package Repository
-
Create a New Source List File: Open or create
/etc/apt/sources.list.d/tor.list
and add the following repository entries:deb [signed-by=/usr/share/keyrings/deb.torproject.org-keyring.gpg] https://deb.torproject.org/torproject.org <DISTRIBUTION> main deb-src [signed-by=/usr/share/keyrings/deb.torproject.org-keyring.gpg] https://deb.torproject.org/torproject.org <DISTRIBUTION> main
Replace
<DISTRIBUTION>
with your OS codename. You can find it by running:# lsb_release -c
or:
# cat /etc/debian_version
-
Optional: Add Experimental or Nightly Builds
For those who want experimental or nightly builds, add the lines below to the same file:
Experimental:
deb [signed-by=/usr/share/keyrings/deb.torproject.org-keyring.gpg] https://deb.torproject.org/torproject.org tor-experimental-<DISTRIBUTION> main deb-src [signed-by=/usr/share/keyrings/deb.torproject.org-keyring.gpg] https://deb.torproject.org/torproject.org tor-experimental-<DISTRIBUTION> main
Nightly Builds:
deb [signed-by=/usr/share/keyrings/deb.torproject.org-keyring.gpg] https://deb.torproject.org/torproject.org tor-nightly-main-<DISTRIBUTION> main deb-src [signed-by=/usr/share/keyrings/deb.torproject.org-keyring.gpg] https://deb.torproject.org/torproject.org tor-nightly-main-<DISTRIBUTION> main
Step 4: Add the GPG Key for Tor Packages
+++ title = “How To Begin Looking At Web Design” menu = “Blog” date = “2024-10-30” +++
Installing a Tor Relay
To ensure package integrity, download and add the GPG key used to sign Tor packages:
# wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --dearmor | tee /usr/share/keyrings/deb.torproject.org-keyring.gpg >/dev/null
Step 5: Update Package List and Install Tor
Now that the repository is set up, update your package list and install Tor along with the Tor Debian keyring package:
# apt update
# apt install tor deb.torproject.org-keyring
Troubleshooting Common Issues
Warning: You may encounter an error message when updating if the repository doesn’t support your architecture:
Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'http://deb.torproject.org/torproject.org focal InRelease' doesn't support architecture 'i386'
To fix this, ensure that you’re using the correct architecture and repository settings.
By following these steps, you’ll be set up to receive secure, up-to-date Tor packages directly from the Tor project on your Debian-based system. This setup ensures you’re always using the latest secure version of Tor for your privacy needs.
Setting Up a Tor Relay on Debian-Based Systems
Setting up a Tor relay enhances online privacy and helps support the Tor network. Follow this guide to create a Tor relay on a Debian-based system. This tutorial includes setting up automatic system updates for security, installing Tor, configuring the relay, and monitoring traffic.
Part 1: Setting Up Unattended Upgrades
Enabling unattended upgrades will keep your system updated with minimal effort, ensuring you receive critical security patches automatically.
Step 1: Update Repositories and Install unattended-upgrades
First, update your repositories and install the required packages:
apt update
apt-get install unattended-upgrades apt-listchanges
Step 2: Configure Unattended Upgrades
Open the configuration file to customize the upgrade settings:
nano /etc/apt/apt.conf.d/50unattended-upgrades
Remove any unnecessary configuration, then add the following settings:
Unattended-Upgrade::Allowed-Origins {
"${distro_id}:${distro_codename}-security";
"TorProject:${distro_codename}";
};
Unattended-Upgrade::Package-Blacklist {
};
Unattended-Upgrade::Automatic-Reboot "true";
This configuration ensures that security updates and Tor packages are automatically upgraded.
Step 3: Test Unattended Upgrades
Run a test to confirm the settings are working:
unattended-upgrade --debug
Part 2: Installing Tor
Installing Tor requires adding the official Tor repositories and GPG keys.
Step 1: Add Official Tor Repositories
Install the HTTPS transport package for secure access to the repository:
apt install apt-transport-https
Check your Debian version:
cat /etc/debian_version
Create a new source file for Tor:
nano /etc/apt/sources.list.d/tor.list
Add the following lines to the file, replacing {yourdistro}
with your Debian version:
deb [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org {yourdistro} main
deb-src [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org {yourdistro} main
Step 2: Add the GPG Key
To authenticate Tor packages, add the Tor project’s GPG key:
wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --dearmor | sudo tee /usr/share/keyrings/tor-archive-keyring.gpg >/dev/null
Step 3: Install Tor
Update your package list and install Tor:
apt update
apt install tor deb.torproject.org-keyring
Part 3: Configuring Tor
With Tor installed, configure it to function as a relay.
Step 1: Open the Tor Configuration File
Edit the Tor configuration file:
nano /etc/tor/torrc
Step 2: Add the Relay Configuration
Add the following configuration to the file:
## BASE CONFIG
Nickname YourRelayNickname
ContactInfo your@e-mail
ORPort 443
ExitRelay 0
SocksPort 0
## BANDWIDTH
# Sets a monthly bandwidth limit (up/down) of 800GB, starting on the 1st at midnight.
AccountingMax 800 GB
AccountingStart month 1 0:00
## MONITORING
ControlPort 9051
CookieAuthentication 1
Replace YourRelayNickname
and your@e-mail
with your chosen relay name and email address.
Step 3: Enable and Restart Tor
To apply the changes, enable Tor at startup and restart the service:
systemctl enable tor
systemctl restart tor
Part 4: Monitoring Tor with Nyx
Nyx is a command-line monitoring tool for Tor relays that provides real-time statistics.
Step 1: Install Nyx
Install Nyx with:
apt install nyx
Step 2: Run Nyx
Launch Nyx to start monitoring your Tor relay:
nyx
Setting up a Tor relay on a Debian-based system is a great way to contribute to internet privacy. With unattended upgrades configured, your system will remain secure with minimal maintenance. Additionally, Nyx provides essential insights into relay performance, helping you monitor and maintain your relay efficiently.