Manage Nethermind with systemd

Create a new user

sudo useradd -m -s /bin/bash nethermind
  • increase the maximum number of open files

sudo bash -c 'echo "nethermind soft nofile 1000000" > /etc/security/limits.d/nethermind.conf'
sudo bash -c 'echo "nethermind hard nofile 1000000" >> /etc/security/limits.d/nethermind.conf'
  • switch to the new user

sudo su - nethermind

Install Dependencies

sudo apt-get update && sudo apt-get install libsnappy-dev libc6-dev libc6 unzip -y

Get Nethermind

  • download the latest Nethermind package

wget [LINUX_PACKAGE_URL]
  • extract the files

unzip [LINUX_PACKAGE_FILENAME] -d build
  • create data directory for logs, database and keystore

mkdir data
  • create .env file inside data directory and provide environment variables to the Node configuration like for example:

NETHERMIND_CONFIG is the important one - defines the network config, the rest is optional.

.env
NETHERMIND_CONFIG="mainnet_pruned"
NETHERMIND_JSONRPCCONFIG_ENABLED=true
NETHERMIND_JSONRPCCONFIG_HOST="0.0.0.0"
NETHERMIND_HEALTHCHECKSCONFIG_ENABLED="true"
  • remove the no more need package (optional)

rm [LINUX_PACKAGE_FILENAME]

Manage Nethermind with systemd

  • download the nethermind.service config

wget https://raw.githubusercontent.com/NethermindEth/nethermind/master/scripts/nethermind.service
  • move the config into the systemd folder

sudo mv nethermind.service /etc/systemd/system/
  • reload the systemd configs

sudo systemctl daemon-reload
  • you can now start, stop, restart Nethermind with systemd

sudo service nethermind start
  • display the current Nethermind output (optional)

journalctl -u nethermind -f
  • enable autorun (optional)

sudo systemctl enable nethermind