Install Tor on Raspberry Pi
I will show how I installed and set up Tor on my Raspberry Pi 64-bit for use with Bitcoin and Lightning network.
This is almost a straight copy of the link in the reference, these are just my notes.
If you’re using a 32-bit rpi then install it via apt and skip these instructions.
Prerequisites
- Raspberry Pi OS 64-bit
Install apt-transport-https
$ sudo apt install apt-transport-https
Get the distribution name of your OS, you’re going to need it in the following section.
$ lsb_release -c
Create a new file named tor.list
$ sudo vi /etc/apt/sources.list.d/tor.list
and paste the content below, replacing <DISTRIBUTION> with the value from lsb_release
deb [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org <DISTRIBUTION> main
deb-src [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org <DISTRIBUTION> main
Download the gpg keys to sign the packages
$ sudo wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | sudo gpg --dearmor | sudo tee /usr/share/keyrings/tor-archive-keyring.gpg >/dev/null
Update apt
$ sudo apt update
Install tor and tor keyring
$ sudo apt install tor deb.torproject.org-keyring --yes
Tor automatically starts on boot ✔️
Configure Tor
I like configuring Tor for local apps via Cookie Authentication
$ sudo vi /etc/tor/torrc
Add the following lines at the top of the file or edit in place
ControlPort 9051
CookieAuthentication 1
CookieAuthFileGroupReadable 1
DataDirectoryGroupReadable 1
Add users to the tor debian-tor
group; only those that are going to be running apps that connect to tor locally, example:
$ sudo usermod -a -G debian-tor sandbox
$ sudo usermod -a -G debian-tor satoshi
Restart if you were using one of those users.
Tor monitoring tool
There are several monitoring tools; the one I installed is nyx
, it’s simple.
$ sudo apt install nyx --yes
Run it with:
$ nyx