-
Notifications
You must be signed in to change notification settings - Fork 26
/
setup.sh
executable file
·118 lines (98 loc) · 3.79 KB
/
setup.sh
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
113
114
115
116
117
118
#/bin/bash
cd ~
echo "****************************************************************************"
echo "* Ubuntu 16.04 is the recommended opearting system for this install. *"
echo "* *"
echo "* This script will install and configure your Transcendence masternodes. *"
echo "****************************************************************************"
echo && echo && echo
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "! !"
echo "! Make sure you double check before hitting enter !"
echo "! !"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo && echo && echo
echo "Do you want to install all needed dependencies (no if you did it before)? [y/n]"
read DOSETUP
if [ $DOSETUP = "y" ]
then
sudo apt update
sudo apt -y upgrade
sudo apt -y dist-upgrade
sudo apt update
sudo apt install -y zip unzip
cd /var
sudo touch swap.img
sudo chmod 600 swap.img
sudo dd if=/dev/zero of=/var/swap.img bs=1024k count=2000
sudo mkswap /var/swap.img
sudo swapon /var/swap.img
sudo free
sudo echo "/var/swap.img none swap sw 0 0" >> /etc/fstab
cd
wget https://github.com/phoenixkonsole/transcendence/releases/download/v1.1.0.0/Linux.zip
unzip Linux.zip
chmod +x Linux/bin/*
sudo mv Linux/bin/* /usr/local/bin
rm -rf Linux.zip Windows Linux Mac
sudo apt install -y ufw
sudo ufw allow ssh/tcp
sudo ufw limit ssh/tcp
sudo ufw logging on
echo "y" | sudo ufw enable
sudo ufw status
mkdir -p ~/bin
echo 'export PATH=~/bin:$PATH' > ~/.bash_aliases
source ~/.bashrc
fi
## Setup conf
IP=$(curl -s4 api.ipify.org)
mkdir -p ~/bin
echo ""
echo "Configure your masternodes now!"
echo "Detecting IP address:$IP"
echo ""
echo "How many nodes do you want to create on this server? [min:1 Max:20] followed by [ENTER]:"
read MNCOUNT
for i in `seq 1 1 $MNCOUNT`; do
echo ""
echo "Enter alias for new node"
read ALIAS
echo ""
echo "Enter port for node $ALIAS"
read PORT
echo ""
echo "Enter masternode private key for node $ALIAS"
read PRIVKEY
RPCPORT=$(($PORT*10))
echo "The RPC port is $RPCPORT"
ALIAS=${ALIAS}
CONF_DIR=~/.transcendence_$ALIAS
# Create scripts
echo '#!/bin/bash' > ~/bin/transcendenced_$ALIAS.sh
echo "transcendenced -daemon -conf=$CONF_DIR/transcendence.conf -datadir=$CONF_DIR "'$*' >> ~/bin/transcendenced_$ALIAS.sh
echo '#!/bin/bash' > ~/bin/transcendence-cli_$ALIAS.sh
echo "transcendence-cli -conf=$CONF_DIR/transcendence.conf -datadir=$CONF_DIR "'$*' >> ~/bin/transcendence-cli_$ALIAS.sh
echo '#!/bin/bash' > ~/bin/transcendence-tx_$ALIAS.sh
echo "transcendence-tx -conf=$CONF_DIR/transcendence.conf -datadir=$CONF_DIR "'$*' >> ~/bin/transcendence-tx_$ALIAS.sh
chmod 755 ~/bin/transcendence*.sh
mkdir -p $CONF_DIR
echo "rpcuser=user"`shuf -i 100000-10000000 -n 1` >> transcendence.conf_TEMP
echo "rpcpassword=pass"`shuf -i 100000-10000000 -n 1` >> transcendence.conf_TEMP
echo "rpcallowip=127.0.0.1" >> transcendence.conf_TEMP
echo "rpcport=$RPCPORT" >> transcendence.conf_TEMP
echo "listen=1" >> transcendence.conf_TEMP
echo "server=1" >> transcendence.conf_TEMP
echo "daemon=1" >> transcendence.conf_TEMP
echo "logtimestamps=1" >> transcendence.conf_TEMP
echo "maxconnections=256" >> transcendence.conf_TEMP
echo "masternode=1" >> transcendence.conf_TEMP
echo "" >> transcendence.conf_TEMP
echo "" >> transcendence.conf_TEMP
echo "port=$PORT" >> transcendence.conf_TEMP
echo "masternodeaddr=$IP:$PORT" >> transcendence.conf_TEMP
echo "masternodeprivkey=$PRIVKEY" >> transcendence.conf_TEMP
sudo ufw allow $PORT/tcp
mv transcendence.conf_TEMP $CONF_DIR/transcendence.conf
sh ~/bin/transcendenced_$ALIAS.sh
done