Previous Page

nihilist@mainpc - 2024-01-31

Monero Node Setup

In this tutorial we're going to take a look at how to setup a monero node

Initial Setup

First install monero from the repositories:


[ nowhere.moe ] [ /dev/pts/0 ] [/srv/nowhere.moe]
→ apt install monero -y
	
[ nowhere.moe ] [ /dev/pts/0 ] [/srv/nowhere.moe]
→ vim /etc/systemd/system/moneronode.service

[ nowhere.moe ] [ /dev/pts/0 ] [/srv/nowhere.moe]
→ cat /etc/systemd/system/moneronode.service
[Unit]
Description=monerod
After=network.target
Wants=network.target

[Service]
ExecStart=/usr/bin/monerod --zmq-pub tcp://127.0.0.1:18083 --disable-dns-checkpoints --enable-dns-blocklist --data-dir /srv/XMR --block-sync-size=50 --out-peers 100 --prep-blocks-threads=128 --prune-blockchain --sync-pruned-blocks --rpc-bind-port=18081 --rpc-bind-ip=0.0.0.0 --p2p-bind-ip=0.0.0.0 --p2p-bind-port=18080 --confirm-external-bind --non-interactive
Restart=on-failure
RestartSec=10s


StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

If you want to have a local-only monero node to use over tor, you can use this config instead:


[ Wonderland ] [ /dev/pts/9 ] [/mnt/md3]
→ cat /etc/systemd/system/moneronode.service
[Unit]
Description=monerod
After=network.target
Wants=network.target

[Service]
ExecStart=/usr/bin/monerod --zmq-pub tcp://127.0.0.1:18083 --disable-dns-checkpoints --enable-dns-blocklist --data-dir /mnt/md3/XMR --block-sync-size=50 --out-peers 100 --prep-blocks-threads=128 --prune-blockchain --sync-pruned-blocks --rpc-bind-port=18081 --rpc-bind-ip=127.0.0.1 --p2p-bind-ip=127.0.0.1 --p2p-bind-port=18080 --non-interactive
Restart=on-failure
RestartSec=10s


StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target


Then wait for it to sync after enabling the systemd service:


[ nowhere.moe ] [ /dev/pts/0 ] [/srv/nowhere.moe]
→ systemctl daemon-reload

[ nowhere.moe ] [ /dev/pts/0 ] [/srv/nowhere.moe]
→ systemctl enable --now moneronode
Created symlink /etc/systemd/system/multi-user.target.wants/moneronode.service → /etc/systemd/system/moneronode.service.

[ nowhere.moe ] [ /dev/pts/0 ] [/srv/nowhere.moe]
→ systemctl status moneronode
● moneronode.service - monerod
     Loaded: loaded (/etc/systemd/system/moneronode.service; enabled; preset: enabled)
     Active: active (running) since Sun 2023-07-09 15:36:44 CEST; 2min 22s ago
   Main PID: 8410 (monerod)
      Tasks: 30 (limit: 77000)
     Memory: 1.7G
        CPU: 1min 53.681s
     CGroup: /system.slice/moneronode.service
             └─8410 /usr/bin/monerod --zmq-pub tcp://127.0.0.1:18083 --disable-dns-checkpoints --enable-dns-blocklist --data-dir /srv/XMR --block-sync-size=50 --out-peers 100 --prep-blocks-threads=128 --prune-blockchain --sync-pruned-blocks --rpc-bind-port=18081 --rpc-bind-ip=0.0.0.0 ->

Jul 09 15:39:06 Datura monerod[8410]: 2023-07-09 13:39:06.055        I Synced 88702/2925934 (3%, 2837232 left)
Jul 09 15:39:06 Datura monerod[8410]: 2023-07-09 13:39:06.188        I Synced 88752/2925934 (3%, 2837182 left)
Jul 09 15:39:06 Datura monerod[8410]: 2023-07-09 13:39:06.310        I Synced 88802/2925934 (3%, 2837132 left)
Jul 09 15:39:06 Datura monerod[8410]: 2023-07-09 13:39:06.452        I Synced 88852/2925934 (3%, 2837082 left)
Jul 09 15:39:06 Datura monerod[8410]: 2023-07-09 13:39:06.576        I Synced 88902/2925934 (3%, 2837032 left)
Jul 09 15:39:06 Datura monerod[8410]: 2023-07-09 13:39:06.756        I Synced 88952/2925934 (3%, 2836982 left)
Jul 09 15:39:06 Datura monerod[8410]: 2023-07-09 13:39:06.890        I Synced 89002/2925934 (3%, 2836932 left)
Jul 09 15:39:07 Datura monerod[8410]: 2023-07-09 13:39:07.060        I Synced 89052/2925934 (3%, 2836882 left)
Jul 09 15:39:07 Datura monerod[8410]: 2023-07-09 13:39:07.182        I Synced 89088/2925934 (3%, 2836846 left)
Jul 09 15:39:07 Datura monerod[8410]: 2023-07-09 13:39:07.376        I Synced 89138/2925934 (3%, 2836796 left)
	

On a SSD it may take 1 day, and weigh approximately 60 gigs as of writing this tutorial. The synchronisation is a very disk-intensive process, and so it is required to do it on a nvme disk or ssd at least. If you try to do that on a HDD it will take much, much longer. If you don't have a choice, sync it on a nvme somewhere and then rsync it to a server that has only HDDs.

Then allow the ports you want from ufw:


root@XMR:~# sudo ufw allow 18080
Rules updated
Rules updated (v6)

root@XMR:~# sudo ufw allow 18081
Rules updated
Rules updated (v6)

Once you've finished setting up your monero instance, make sure you have it listed on https://monero.fail or on https://xmr.nowhere.moe.

Onion Setup

Once your monero node is synchronized, you can allow tor users to access it via a .onion link like so:


[ Wonderland ] [ /dev/pts/9 ] [~]
→ apt install tor

[ Wonderland ] [ /dev/pts/9 ] [~]
→ cat /etc/tor/torrc
HiddenServiceDir /var/lib/tor/monero-service/
HiddenServicePort 18080 127.0.0.1:18080
HiddenServicePort 18081 127.0.0.1:18081


[ Wonderland ] [ /dev/pts/9 ] [~]
→ systemctl restart tor@default

Then find your onion link right here:


[ Wonderland ] [ /dev/pts/9 ] [~]
→ cat /var/lib/tor/monero-service/hostname
uyjehlovjudh2wlvkp5a2seme5vgqc4o463atkv2ulsovloqrqw2icyd.onion

And then you can use it to connect to it via your monero wallet. as shown here


apt install monero -y

monero-wallet-cli
#follow the instructions to create your wallet
#synchronize it with this command:
set_daemon http://uyjehlovjudh2wlvkp5a2seme5vgqc4o463atkv2ulsovloqrqw2icyd.onion:18081 trusted
#then wait for the daemon to finish synchronizing, and type "refresh" regularly to make sure that it synchronizes with the node, expect to type that command a few times as tor connections are unstable at times.
refresh
status

Nihilism

Until there is Nothing left.

About nihilist

Donate XMR: 8AUYjhQeG3D5aodJDtqG499N5jXXM71gYKD8LgSsFB9BUV1o7muLv3DXHoydRTK4SZaaUBq4EAUqpZHLrX2VZLH71Jrd9k8


Contact: nihilist@contact.nowhere.moe (PGP)