Before we start, you will need a Debian VPS (you can get one on digitalocean for example), if you prefer to use your own self hosted server, make sure that port 80 and 443 are correctly port forwarded so that the public ip points to the server and not the router. Once that's done, go and ssh into your debian 10 server.
You will also need to make sure that the VPS provider allows the hosting of a tor node! check torproject's good/bad isps page here.
For example, you wouldn't be able to host an exit node on DigitalOcean, however hosting a regular node is completely fine.
Now regarding the choice of location for the server, in order to make sure that Tor remains decentralised, make sure that you are picking a country that doesn't have many tor nodes (see the bubbles graph):
Disclaimer: Do not host your Tor node in Germany, Netherlands or in the US, as there are already too many nodes in those countries. Try to run your own Tor nodes in countries that have the least nodes preferably, as this will help keeping the Tor network decentralized.
apt update -y && apt upgrade -y
apt install curl tmux vim gnupg2 -y
root@Datura:~# cat /etc/apt/sources.list |head -n3
deb [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org bookworm main
deb-src [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org bookworm main
root@Datura:~# wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --dearmor | tee /usr/share/keyrings/tor-archive-keyring.gpg >/dev/null
apt update -y
apt install tor nyx
#To configure tor we need to edit the configuration file with the following entry. Replace the TODOs with the port numbers you wish to use
#Open conf file
vim /etc/tor/torrc
# Replace "TODO1" with a Tor port of your choice.
# This port must be externally reachable.
# Avoid port 9001 because it's commonly associated with Tor and censors may be scanning the Internet for this port.
ORPort 37051
# Local communication port between Tor and obfs4. Always set this to "auto".
# "Ext" means "extended", not "external". Don't try to set a specific port number, nor listen on 0.0.0.0.
ExtORPort auto
# Replace "<address@email.com>" with your email address so we can contact you if there are problems with your bridge.
# This is optional but encouraged.
ContactInfo nihilist@nowhere.moe
# Pick a nickname that you like for your bridge. This is optional.
Nickname Nihilist
Then restart the tor service + enable it:
#Restart service
systemctl restart tor@default
#Enable at boot
systemctl enable --now tor@default
#monitor it with nyx
nyx
You can also monitor connections by switching to the menu (pressing m)
and then just use the arrow keys to navigate:
Hit spacebar to choose "connection"
EDIT: you can just use left arrow and right arrow to change menus quickly lol
This is going to list the active connections (Circuits) to your tor node with their ip addresses.
Donate XMR: 8AUYjhQeG3D5aodJDtqG499N5jXXM71gYKD8LgSsFB9BUV1o7muLv3DXHoydRTK4SZaaUBq4EAUqpZHLrX2VZLH71Jrd9k8
Contact: nihilist@contact.nowhere.moe (PGP)