-
Notifications
You must be signed in to change notification settings - Fork 1
/
setupUbuntu.sh
131 lines (112 loc) · 2.89 KB
/
setupUbuntu.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
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/bash
if [[ $UID != 0 ]]; then
echo "Please run this script with sudo:"
echo "sudo bash $0 $*"
exit 1
fi
spinner()
{
local pid=$1
local delay=0.1
local spinstr='|/-\'
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
local temp=${spinstr#?}
printf " [%c] " "$spinstr"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
done
printf " \b\b\b\b"
}
update(){
{
apt-get -y update
apt-get -y install curl
apt-get -y install gcc
apt-get -y install libsm6
apt-get -y install bzip2
apt-get -y install libxrender1
} 1> /dev/null
}
nodeInstall(){
if type node 2>/dev/null; then
printf "\n Node already installed \n"
else
{
curl -sL https://deb.nodesource.com/setup | sudo bash -
apt-get -y install nodejs
} 1> /dev/null
fi
}
dependencies(){
{
cd web
npm install
npm install pm2 -g
npm install bower -g
sudo -u ${SUDO_USER:-$USER} bower install
} 1> /dev/null
}
mini(){
if [ -f /home/${SUDO_USER:-$USER}/miniconda/bin/conda ]; then
printf "\n Miniconda already installed\n"
else
if [ `uname -m` == 'x86_64' ]
then
{
curl https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -o ~/miniconda.sh
} &> /dev/null
else
{
curl https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86.sh -o ~/miniconda.sh
} &> /dev/null
fi
fi
}
installmini(){
if [ -f /home/${SUDO_USER:-$USER}/miniconda/bin/conda ]; then
printf "\nMiniconda Already Installed\n"
else
bash ~/miniconda.sh
fi
}
pydepends(){
{
/home/${SUDO_USER:-$USER}/miniconda/bin/conda install numpy
/home/${SUDO_USER:-$USER}/miniconda/bin/conda install scipy
/home/${SUDO_USER:-$USER}/miniconda/bin/conda install matplotlib
/home/${SUDO_USER:-$USER}/miniconda/bin/conda install scikit-learn
/home/${SUDO_USER:-$USER}/miniconda/bin/pip install librosa==0.3.1
} 1> /dev/null
}
forward(){
{
iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 5000 -j ACCEPT
iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 5000
}
}
printf "\nUpdating system...\n"
update & spinner $!
printf " done\n"
printf "\nInstalling node...\n"
nodeInstall & spinner $!
printf " done\n"
printf "\nInstalling dependencies...\n"
dependencies
printf " done\n"
printf "\nDownloading Miniconda...\n"
mini & spinner $!
printf "\nInstalling Miniconda...\n"
installmini
printf " done\n"
printf "\nInstalling Python Packages...\n"
pydepends & spinner $!
printf " done\n"
printf "\nForwarding Ports...\n"
forward & spinner $!
printf " done\n"
printf "\nSick Beetz has been succesfully installed."
printf "\nStart the app by naviagting to the web folder\n"
printf "\nAnd inputting 'pm2 start app.js'\n"
printf "\nView the Wiki for more information\n"