-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathnodeInstall.sh
More file actions
112 lines (93 loc) · 3.69 KB
/
nodeInstall.sh
File metadata and controls
112 lines (93 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
# This script will install all the required packages for running a Nova Network
# node, as well as setting all the necessary environment variables.
# This script requires elevated access privileged (chmod 755), please run:
# chmod 755 nodeInstall.sh before launching, and then bash nodeInstall.sh to start.
minRAM=8 # Minimum RAM requirements in GB
minDisk=200 # Minimum Disk space requirements in GB
reqOS=Ubuntu # Required OS
minOSver=20.04 # Minimum OS version
# Welcoming message.
echo "Welcome to Nova Netowrk Installation Script"
echo ""
echo "This script will install all dependencies required"
echo "for you to run a Nova Network node."
echo ""
# Sanity Check 1 - Do we have enough free disk space?
echo "Minimum Requirements 1/4 - Checking your available disk space..."
currDisk=`df -H --output=avail "$PWD" | tail -n 1 | tr -d " " | tr -d "G"`
if [[ ${currDisk} -lt ${minDisk} ]]
then
echo "Minimum Disk Space Required = ${minDisk}GB, Available ${currDisk}GB. Aborting."
exit
else
echo "You have enough available disk space to continue."
fi
echo ""
# Sanity Check 2 - Do we have enough RAM memory?
echo "Minimum Requirements 2/4 - Checking your available RAM..."
currRAM=`free -g | grep -oP '\d+' | head -n 1`
if [[ ${currRAM} -lt ${minRAM} ]]
then
echo "Minimum RAM Required = ${minRAM}GB, Available ${currRAM}GB. Aborting."
exit
else
echo "You have enough RAM available to continue."
fi
""
# Sanity Check 3 - Do we have the correct OS?
echo "Minimum Requirements 3/4 - Checking your OS..."
currOS=`cat /etc/os-release | grep ^NAME= | tr -d "NAME=" | tr -d "\""`
if [[ ${currOS} != ${reqOS} ]]
then
echo "Required OS is ${reqOS}, but current OS is ${currOS}. Aborting."
exit
else
echo "You are running a compatible OS."
fi
""
# Sanity Check 4 - Does the OS version meet minimum requirements?
echo "Minimum Requirements 4/4 - Checking your OS version..."
currOSver=`cat /etc/os-release | grep VERSION_ID | tr -d "VERSION_ID=" | tr -d "\""`
if (( $(echo "$currOSver < $minOSver" | bc -l) ))
then
echo "Current OS version ${currOSver} does not meet minimum version ${minOSver} requirement. Aborting."
exit
else
echo "Your OS version is compatible."
fi
echo "Your machine has passed all the minimum requirements checks."
echo "Proceeding to the installation process..."
echo ""
# Sanity checks passed! Start installing packages.
# Install a backup instance of Go-Ethereum for dependencies.
echo "Installing 1/5 - Downloading dependencies..."
sudo apt-get upgrade
sudo apt-get update
# Install Golang to be able to build Go Nova.
echo "Installing 2/5 - Installing Golang..."
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt update
sudo apt upgrade
sudo apt install golang-go
sudo apt install make
# Install Screen to be able to run the node on a detached screen.
echo "Installing 3/5 - Installing Screen..."
sudo apt install screen
# Download genesis block to start the network.
echo "Installing 4/5 - Downloading Genesis Block and TOML..."
sudo wget https://novanetwork.io/download/271BD152B3C22467FA81F5F35B5EB9B6B9C2C827349E627B7B794DE8690707BA/novanetwork
sudo wget https://novanetwork.io/download/271BD152B3C22467FA81F5F35B5EB9B6B9C2C827349E627B7B794DE8690707BA/novanetwork.toml
# Build Go Nova using Golang.
echo "Installing 5/5 - Building Go Nova..."
sudo make novanetwork-full
sudo chmod 755 build/bin/geth
sudo mv build/bin/geth build/bin/novanetwork
sudo chmod 755 build/bin/novanetwork
sudo mv build/bin/novanetwork /usr/bin
# Cleanup the screen.
clear
# Display finished message.
echo "The installation script has finished. Thank you for installing Nova Network."
echo "You can start your node by running the start-node script."
echo ""