Skip to content

Instantly share code, notes, and snippets.

@MyAltcoins
Last active November 2, 2023 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MyAltcoins/8df8d20da33fedaa25dc80e1faf10368 to your computer and use it in GitHub Desktop.
Save MyAltcoins/8df8d20da33fedaa25dc80e1faf10368 to your computer and use it in GitHub Desktop.
Easy Nyzo Verifier and Sentinel Installation Script
#!/bin/bash
echo " __ "
echo " /\ \ \_ _ _______ "
echo " / \/ / | | |_ / _ \ "
echo "/ /\ /| |_| |/ / (_) |"
echo "\_\ \/ \__/ /___\___/ "
echo " |___/ "
echo ""
echo "## Welcome to the Nyzo installation script ##"
echo "---------------------------------------------"
echo "https://myaltcoins.info/nyzo-review/"
echo ""
echo "## Checking Linux version and release ... "
distribution=$(lsb_release -is)
release=$(lsb_release -rs)
codename=$(lsb_release -cs)
if [[ ! $distribution =~ ("Debian"|"Ubuntu") ]]; then
echo "## Your distribution ($distribution) is not supported. Script requires Ubuntu." && exit 1
fi
if [[ ! $codename =~ ("xenial"|"bionic"|"jessie"|"stretch"|"buster") ]]; then
echo "## Your release ($codename) of $distribution is not supported." && exit 1
fi
echo "## I have determined you are using $distribution $release."
echo ""
read -p "Enter '1' for Verifier or '2' for Sentinel installation: " NYZO_TYPE
echo "## Setting paths and installing dependencies ... "
cd /home/
mkdir ubuntu
cd ubuntu
sudo apt update -qq
sudo apt install -y git htop nano haveged openjdk-8-jdk supervisor
echo "## Dependencies installed."
echo "## Time to compile ... "
git clone https://github.com/n-y-z-o/nyzoVerifier.git
cd nyzoVerifier
./gradlew build
sudo mkdir -p /var/lib/nyzo/production
if [ $NYZO_TYPE -eq 1 ]
then
echo ""
echo "## Installing Nyzo Verifier ... "
echo ""
sudo ufw allow 9444/tcp
sudo ufw allow 9446/udp
sudo cp trusted_entry_points /var/lib/nyzo/production
chmod +x nyzoVerifier.sh && ./nyzoVerifier.sh && sudo cp nyzoVerifier.conf /etc/supervisor/conf.d/
echo ""
read -p "Enter Verifier nickname: " NICKN
sudo echo $NICKN > /var/lib/nyzo/production/nickname
sudo echo -e "block_file_consolidator=delete\nlog_timestamps=1" > /var/lib/nyzo/production/preferences
sudo supervisorctl reload
echo "## Installing cron job ... "
echo "@reboot sudo supervisorctl reload" >> mycron
crontab mycron
rm mycron
echo "## Cron job installed."
echo "## Getting Verifier status, wait a bit ... "
sleep 9
sudo supervisorctl status
echo ""
echo "###################################################################"
echo "Verifier private key, store it in a safe place:"
cat /var/lib/nyzo/production/verifier_private_seed
echo "###################################################################"
echo ""
echo "Check the status (orange is the color you want to see initially) of your Verifier here: https://nyzo.co/queue/all"
else
echo ""
echo "## Installing Nyzo Sentinel ... "
echo ""
chmod +x nyzoSentinel.sh && ./nyzoSentinel.sh && sudo cp nyzoSentinel.conf /etc/supervisor/conf.d/
echo "## Get ready to add your Verifiers to the Sentinel watch list ... "
sleep 5
sudo echo -e "#VerifierIP1:9444:VerifierPrivateKey1\n#VerifierIP2:9444:VerifierPrivateKey2\n#VerifierIP3:9444:VerifierPrivateKey3" > /var/lib/nyzo/production/managed_verifiers
sudo nano /var/lib/nyzo/production/managed_verifiers
sudo echo -e "block_file_consolidator=delete\nlog_timestamps=1" > /var/lib/nyzo/production/preferences
sudo supervisorctl reload
echo "## Installing cron job ... "
echo "@reboot sudo supervisorctl reload" >> mycron
crontab mycron
rm mycron
echo "## Cron job installed."
echo "## Getting Sentinel status, wait a bit ... "
sleep 9
sudo supervisorctl status
echo "## Managed Verifiers list:"
cat /var/log/nyzo-sentinel.log | grep 'ManagedVerifier'
echo ""
echo "Whitelist the Sentinel on your Verifiers https://nyzo.co/releaseNotes/497"
fi
echo ""
echo "-----------------------"
echo "Installation completed!"
echo "-----------------------"
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment