Run Witnet as a systemd service
The runner.sh script automatically downloads and installs the latest version of the Witnet node software (witnet-rust). It can also be used to update to the latest version, since it will keep all the block chain data and the configuration file in the hidden .witnet directory.
For Testnet 7.3 and greater, the configuration file needs to be customized with the public IP and port of the node, which must be set at the public_addr field in witnet.toml .
  • Install latest version of ca-certificates to download safely from GitHub:
1
sudo apt install ca-certificates
2
sudo update-ca-certificates
Copied!
  • Create the witnet user dedicated to running the node:
1
sudo adduser witnet
Copied!
  • Clone the project's GitHub repository into your home directory and enter it:
1
cd
2
git clone https://github.com/witnet/witnet-operator-tools.git
3
cd witnet-operator-tools
Copied!
  • Install latest version with the witnet user dedicated to running the node:
1
sudo -u witnet ./systemd/runner.sh
Copied!
  • Copy the witnet.service file into /lib/systemd/system/:
1
sudo cp systemd/witnet.service /lib/systemd/system/witnet.service
Copied!
  • Every time you change the witnet.service file, you need to reload the systemd daemon:
1
sudo systemctl daemon-reload
Copied!
  • Enable the service:
1
sudo systemctl enable witnet.service
Copied!
  • Start the service:
1
sudo systemctl start witnet.service
Copied!
  • See the logs of the service:
1
journalctl -f -u witnet.service
Copied!
  • When you want to restart the service:
1
sudo systemctl restart witnet.service
Copied!
Copy link
Edit on GitHub