How do I run monerod as a systemd service?
You can run monerod, the program that operates a Monero node, as a systemd service so Linux starts it at boot and restarts it after a crash. The setup below uses a dedicated user, keeps the blockchain in /var/lib/monero, and leaves the node’s control interface accessible only from your own computer.
1. Install the program and create its user
These steps assume your Linux distribution uses systemd, its built-in service manager, and that you have sudo access.
Download the official Monero command-line tools and verify the release before installing. From the directory containing your verified monerod file, run:
sudo install -m 0755 monerod /usr/local/bin/monerod
sudo useradd --system --home-dir /var/lib/monero \
--shell /usr/sbin/nologin monero
sudo install -d -o monero -g monero -m 0750 /var/lib/monero
sudo install -d -m 0755 /etc/monero
The monero account cannot log in interactively. It owns the blockchain files, so the service does not need administrator privileges.
Check available disk space before continuing. Even a pruned node needs substantial storage, and its storage needs grow over time.
2. Create the node configuration
Open a new configuration file:
sudo nano /etc/monero/monerod.conf
Paste:
data-dir=/var/lib/monero
log-file=/var/lib/monero/monerod.log
log-level=0
prune-blockchain=1
rpc-bind-ip=127.0.0.1
rpc-bind-port=18081
Pruning reduces disk use by removing some historical transaction data while keeping what your node needs to validate the blockchain.
RPC is the interface that wallets and mining software use to communicate with your node. Binding it to 127.0.0.1 keeps it local. Do not expose port 18081 to the internet casually.
If you will run P2Pool on this same computer, also add:
zmq-pub=tcp://127.0.0.1:18083
This provides ZeroMQ notifications: quick updates that P2Pool uses to learn about new blocks. P2Pool still runs as a separate program.
3. Add the systemd service
Create the service file:
sudo nano /etc/systemd/system/monerod.service
Paste:
[Unit]
Description=Monero node
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=monero
Group=monero
ExecStart=/usr/local/bin/monerod --config-file=/etc/monero/monerod.conf --non-interactive
Restart=on-failure
RestartSec=10
TimeoutStopSec=300
KillSignal=SIGINT
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full
ProtectHome=true
[Install]
WantedBy=multi-user.target
--non-interactive disables the interactive console. Do not add --detach: systemd needs the program to stay in the foreground so it can supervise it.
The stop settings allow time for the node to close its blockchain database cleanly.
4. Start it and check progress
Load the service definition, enable startup at boot, and start it now:
sudo systemctl daemon-reload
sudo systemctl enable --now monerod
sudo systemctl status monerod
Watch the node’s log for synchronization progress:
sudo tail -f /var/lib/monero/monerod.log
For startup failures, inspect systemd’s records:
sudo journalctl -u monerod -n 100 --no-pager
Initial synchronization downloads and verifies blockchain history. Wait until it finishes before relying on the node for mining.
After editing the configuration, restart with:
sudo systemctl restart monerod
Stop cleanly with sudo systemctl stop monerod. Avoid running another node instance against the same data directory.
The bottom line
You now have a node that starts automatically and runs without administrator privileges. This service runs the node, not a miner; your solo-mining software or P2Pool connects to it separately.
