| Description | Command |
---|
1 | Install the universe repository and packages for certbot and ensure other packages are installed and up to date from the official guide |
Code Block |
---|
sudo apt install software-properties-common -y |
Skip adding the universe repository on Debian systems, DO NOT SKIP THE OTHER ENTRIES IN THIS STEP Code Block |
---|
sudo add-apt-repository universe -y |
Be sure to copy the entire command, especially for long command strings Code Block |
---|
sudo apt-get install build-essential software-properties-common apt-transport-https lsb-release dirmngr pwgen git jq ufw curl -y |
|
2 | Update the package cache |
Code Block |
---|
sudo apt-get update -y |
|
3 | Install curl and add the nodejs repository and update the package cache
NOTE: Skip this step for Ubuntu
| Debian 9 only Code Block |
---|
sudo apt-get install curl -y
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get update -y |
|
4 | Install npm, upgrading it to the stable version |
Code Block |
---|
sudo apt-get install npm -y && sudo npm install -g n && sudo n stable |
|
5 | Stop the node tracker NOTE: If for some reason you have more than one tracker running in pm2, you may have to change "0" to the number that corresponds with your tracker, and stop those as well. You can get a listing of the numbers from running: pm2 list | |
6 | Move (mv) the securenodetracker folder, renaming it in the process, generally this will be ~/zencash/secnodetracker and change directory (cd) to the new folder |
Code Block |
---|
mv ~/zencash/secnodetracker ~/nodetracker && cd ~/nodetracker |
|
7 | Update git with the new repository URL and retrieve the latest source code |
Code Block |
---|
git checkout -- package.json
git remote set-url origin https://github.com/ZencashOfficial/nodetracker.git
git fetch origin
git checkout master
git pull |
NOTE: If git returns an error regarding any files run the following command (replacing 'filename with the file returned in the error message) and repeat the commands above Code Block |
---|
git checkout -- filename |
|
8 | Install the latest set of node modules required for the tracker |
|
9 | Locate your node's public IPv4 and/or IPv6 address(es) and append them to the zen.conf file as external IP address(es) connected over port 9033 (default) ONLY SUPER NODES ARE REQUIRED TO PERFORM EVERY COMMAND IN THIS STEP SECURE NODES REQUIRE AT LEAST ONE EXTERNAL ADDRESS AND PORT APPENDED INTO ZEN.CONF NOTE: Secure Nodes only require one type of IP, Super Nodes require both NOTE: Replace <IPv4> with the public IPv4 of your node, remove <brackets> NOTE: Replace <IPv6> with the public IPv6 of your node in compressed notation without leading zeros, remove <brackets> Use the following link to ensure your IPv6 address is in compressed notation: https://www.ultratools.com/tools/ipv6Compress | Create environmental variables for IPv4 Append external IPv4 into zen.conf Code Block |
---|
echo "externalip=$IPV4" >> ~/.zen/zen.conf |
Create environmental variables for IPv6 Append external IPv6 into zen.conf Code Block |
---|
echo "externalip=$IPV6" >> ~/.zen/zen.conf |
Append port into zen.conf - SECURE AND SUPER Code Block |
---|
echo "port=9033" >> ~/.zen/zen.conf |
|
10 | Run node setup again to refresh the list of tracker servers and initialise the new tracker, press enter through each of the values to retain the current set - Enter 'secure' for the 'node category' prompt
|
|
11 | Stop zend with monit, then stop monit. Both commands are shown to stop via systemctl and sysinit (only one should be needed, but both are here for completeness) |
Code Block |
---|
sudo monit stop zend && sleep 8
sudo systemctl stop monit
sudo service monit stop |
|
12 | Create a systemd unit file for zend, copy and paste the entire block of text |
Code Block |
---|
echo \
"[Unit]
Description=Zen daemon
[Service]
User=$USER
Type=forking
ExecStart=/usr/bin/zend -daemon -pid=$HOME/.zen/zend.pid
PIDFile=$HOME/.zen/zend.pid
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target" | sudo tee /lib/systemd/system/zend.service |
|
13 | Test the zend unit file |
Code Block |
---|
sudo systemctl start zend && sleep 30 |
|
14 | Create a systemd unit file for the Node Tracker, copy and paste the entire block of text
|
Code Block |
---|
echo \
"[Unit]
Description=Zen node daemon installed on ~/nodetracker/
[Service]
User=$USER
Type=simple
WorkingDirectory=$HOME/nodetracker/
ExecStart=$(which node) $HOME/nodetracker/app.js
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target" | sudo tee /lib/systemd/system/zentracker.service |
|
15 | Test the tracker unit file |
Code Block |
---|
sudo systemctl start zentracker |
|
16 | Follow the tracker output log to check everything looks OK, if all appears fine, exit with CTRL+c |
Code Block |
---|
sudo journalctl -fu zentracker |
Panel |
---|
borderColor | grey |
---|
bgColor | black |
---|
titleColor | white |
---|
borderWidth | 2 |
---|
titleBGColor | black |
---|
borderStyle | solid |
---|
title | Example Output |
---|
| zenops@node01~$ sudo journalctl -fu zentracker -- Logs begin at Tue 2018-05-22 12:54:41 EDT. -- May 24 21:34:28 node01 node[42000]: 2018-05-25 01:34:28 GMT -- Connected to server ts1.na. Initializing... May 24 21:34:28 node01 node[42000]: Secure Node t_address (not for stake)=znXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX May 24 21:34:28 node01 node[42000]: Balance for challenge transactions is 0.0247 May 24 21:34:28 node01 node[42000]: Using the following address for challenges May 24 21:34:28 node01 node[42000]: zcXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX May 24 21:34:29 node01 node[42000]: 2018-05-25 01:34:29 GMT -- Authenticated May 24 21:34:29 node01 node[42000]: 2018-05-25 01:34:29 GMT -- Updated server list May 24 21:34:29 node01 node[42000]: 2018-05-25 01:34:29 GMT -- Stats: send initial stats. May 24 21:34:29 node01 node[42000]: 2018-05-25 01:34:29 GMT -- Stats received by ts1.na May 24 21:34:29 node01 node[42000]: 2018-05-25 01:34:29 GMT -- Cert check: valid=true. Hostname node01.zentest.win matches CN node01.zentest.win |
|
17 | Check the status of both zend and the tracker, both should return active (running). If the status doesn't send you back to a command prompt, exit the status details by pressing CTRL + c |
Code Block |
---|
sudo systemctl status zend zentracker |
Panel |
---|
borderColor | grey |
---|
bgColor | black |
---|
titleColor | white |
---|
borderWidth | 2 |
---|
titleBGColor | black |
---|
borderStyle | solid |
---|
title | Example Output |
---|
| zenops@node01:~$ sudo systemctl status -n 0 zend zentracker ● zend.service - Zen daemon Loaded: loaded (/lib/systemd/system/zend.service; disabled; vendor preset: enabled) Active: active (running) since Thu 2018-05-24 22:31:30 EDT; 34s ago Process: 21612 ExecStart=/usr/bin/zend -daemon -pid=/home/zenops/.zen/zend.pid (code=exited, status=0/SUCCESS) Main PID: 21615 (zend) Tasks: 16 Memory: 810.0M CPU: 18.963s CGroup: /system.slice/zend.service └─21615 /usr/bin/zend -daemon -pid=/home/zenops/.zen/zend.pid May 24 22:31:30 node01 systemd[1]: Starting Zen daemon... May 24 22:31:30 node01 zend[21612]: Zen server starting May 24 22:31:30 node01 systemd[1]: zend.service: PID file /home/zenops/.zen/zend.pid not readable (yet?) after start: No such file or directory May 24 22:31:30 node01 systemd[1]: Started Zen daemon. ● zentracker.service - Zen node daemon installed on ~/nodetracker/ Loaded: loaded (/lib/systemd/system/zentracker.service; disabled; vendor preset: enabled) Active: active (running) since Thu 2018-05-24 21:34:27 EDT; 1h 1min ago Main PID: 19648 (node) Tasks: 10 Memory: 38.9M CPU: 4.110s CGroup: /system.slice/zentracker.service └─19648 /usr/local/bin/node /home/zenops/nodetracker/app.js |
|
18 | If both work correctly, enable them at boot |
Code Block |
---|
sudo systemctl enable zend zentracker |
|
19 | Use systemctl to enable the firewall NOTE: Many guides lacked enabling this under systemctl If the firewall is not installed, see: Part 5 - Securing the Host |
Code Block |
---|
sudo ufw -f enable
sudo systemctl start ufw
sudo systemctl enable ufw
sudo systemctl status ufw |
Panel |
---|
borderColor | grey |
---|
bgColor | black |
---|
titleColor | white |
---|
borderWidth | 2 |
---|
titleBGColor | black |
---|
borderStyle | solid |
---|
title | Example Output |
---|
| zenops@node01:~$ sudo systemctl status ufw [sudo] password for zenops: ● ufw.service - Uncomplicated firewall Loaded: loaded (/lib/systemd/system/ufw.service; enabled; vendor preset: enabled) Active: active (exited) since Sat 2018-05-26 16:03:39 EDT; 23min ago Process: 603 ExecStart=/lib/ufw/ufw-init start quiet (code=exited, status=0/SUCCESS) Main PID: 603 (code=exited, status=0/SUCCESS) Tasks: 0 Memory: 0B CPU: 0 CGroup: /system.slice/ufw.service May 26 16:03:39 node01 systemd[1]: Started Uncomplicated firewall. |
|
20 | Remove pm2 from startup |
Code Block |
---|
sudo rm /etc/systemd/system/pm2*
sudo rm /etc/systemd/system/multi-user.target.wants/pm2* |
|
21 | Kill and remove PM2 (if all of the above executed without error) You may see a message about updating npm, you may ignore this |
Code Block |
---|
pm2 kill
sudo npm remove pm2 -g
sudo rm -r ~/.pm2 |
Panel |
---|
borderColor | grey |
---|
bgColor | black |
---|
titleColor | white |
---|
borderWidth | 2 |
---|
titleBGColor | black |
---|
borderStyle | solid |
---|
title | Example Output |
---|
| zenops@node01:~$ pm2 kill [PM2] Stopping PM2... [PM2] Applying action deleteProcessId on app [all](ids: 0) [PM2] [securenodetracker](0) ✓ [PM2] All processes have been stopped and deleted [PM2] PM2 stopped |
Panel |
---|
borderColor | grey |
---|
bgColor | black |
---|
titleColor | white |
---|
borderWidth | 2 |
---|
titleBGColor | black |
---|
borderStyle | solid |
---|
title | Example Output |
---|
| zenops@node01:~$ sudo npm remove pm2 -g removed 135 packages in 2.873s |
|
22 | Remove monit from startup (you may not require both commands, both are present to accommodate either systemd, or init script) Run both commands if you're unsure of which way monit was configured
NOTE: It is expected that you will see an error if you execute the command that doesn't correspond with how monit was setup. You can safely dismiss errors from the one command of the two presented here. |
Code Block |
---|
sudo systemctl disable monit
sudo update-rc.d monit remove |
|
23 | Remove and purge monit from system and remove old repositories (if all of the above executed without error)
|
Code Block |
---|
sudo apt-get remove monit -y
sudo apt-get purge monit -y
sudo apt-get -y autoremove
rm -rf ~/zen_node.sh |
|
24 | acme.sh - Migration to certbot |
|