Shell script
To fast install of a full node use the following
Normal Node
#!/bin/bash
# install mono-devel and other libs needed to get ZEN NODE up and running.
install_mono(){
echo "Adding Mono-devel Repo"
sudo apt install gnupg ca-certificates -y
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt upgrade -y
# install mono-devel, Lighting Memory-Mapped Database lib and unzip
sudo apt install mono-devel -y
sudo apt install liblmdb0 -y
sudo apt install unzip -y
}
#---------------------------------------------------------------------------------------
#ENTRY POINT
# check for mono-devel.
which mono || install_mono # only install and upgrade the system if mono-devel is missing
# NVM Sections
echo "---------------------------------------------------"
echo "NVM SETUP."
sudo echo ' '
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install --lts
npm config set @zen:registry https://www.myget.org/F/zenprotocol/npm/
npm install @zen/zen-node -g
# set data path location for the database
DATAPATH="$HOME/.config/zen-node"
echo "---------------------------------------------------"
echo "Generating Zen-Node Service File..."
# generate the service file then save it appropriately
printf "[Unit]
Description=Zen Node
After=network.target
[Service]
Type=simple
WorkingDirectory=$HOME/.nvm/versions/node/$(node --version)/lib/node_modules/@zen/zen-node/Release/
ExecStart=/usr/bin/mono $HOME/.nvm/versions/node/$(node --version)/lib/node_modules/@zen/zen-node/Release/zen-node.exe --data-path "$DATAPATH" --api "*:11567"
Restart=on-failure
[Install]
WantedBy=multi-user.target
" | sudo tee /etc/systemd/system/zen-node.service
# check for the blockchain DB, if present, continue.
# if absent, check for the zipped version and extract it.
# if no zipped version present, download the one hosted.
if [[ ! -s $DATAPATH ]] ; then
echo "---------------------------------------------------"
if [[ ! -s "zen-node.zip" ]] ; then
echo "Downloading Blockchain..."
# download zen-node.zip from s3
wget https://node-backups.s3-eu-west-1.amazonaws.com/zen-node.zip
fi
echo "Unziping The BlockchainDB in $DATAPATH..."
unzip zen-node.zip -d "$HOME/.config"
fi
echo "---------------------------------------------------"
echo "Starting ZEN NODE...."
sudo systemctl enable zen-node.service
sudo systemctl start zen-node.service
sudo journalctl -f -u zen-node.service
Address Node (Explorer and Exchange)
#!/bin/bash
# install mono-devel and other libs needed to get ZEN NODE up and running.
install_mono(){
echo "Adding Mono-devel Repo"
sudo apt install gnupg ca-certificates -y
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt upgrade -y
# install mono-devel, Lighting Memory-Mapped Database lib and unzip
sudo apt install mono-devel -y
sudo apt install liblmdb0 -y
sudo apt install unzip -y
}
#---------------------------------------------------------------------------------------
#ENTRY POINT
# check for mono-devel.
which mono || install_mono # only install and upgrade the system if mono-devel is missing
# NVM Sections
echo "---------------------------------------------------"
echo "NVM SETUP."
sudo echo ' '
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install --lts
npm config set @zen:registry https://www.myget.org/F/zenprotocol/npm/
npm install @zen/zen-node -g
# set data path location for the database
DATAPATH="$HOME/.config/zen-node"
echo "---------------------------------------------------"
echo "Generating Zen-Node Service File..."
# generate the service file then save it appropriately
printf "[Unit]
Description=Zen Node
After=network.target
[Service]
Type=simple
WorkingDirectory=$HOME/.nvm/versions/node/$(node --version)/lib/node_modules/@zen/zen-node/Release/
ExecStart=/usr/bin/mono $HOME/.nvm/versions/node/$(node --version)/lib/node_modules/@zen/zen-node/Release/zen-node.exe --data-path "$DATAPATH" --api "*:11567" --addressdb
Restart=on-failure
[Install]
WantedBy=multi-user.target
" | sudo tee /etc/systemd/system/zen-node.service
# check for the blockchain DB, if present, continue.
# if absent, check for the zipped version and extract it.
# if no zipped version present, download the one hosted.
if [[ ! -s $DATAPATH ]] ; then
echo "---------------------------------------------------"
if [[ ! -s "zen-node.zip" ]] ; then
echo "Downloading Blockchain..."
# download zen-node.zip from s3
wget https://node-backups.s3-eu-west-1.amazonaws.com/zen-node-addressdb.zip
fi
echo "Unziping The BlockchainDB in $DATAPATH..."
unzip zen-node.zip -d "$HOME/.config"
fi
echo "---------------------------------------------------"
echo "Starting ZEN NODE...."
sudo systemctl enable zen-node.service
sudo systemctl start zen-node.service
sudo journalctl -f -u zen-node.service
Last updated