-
Notifications
You must be signed in to change notification settings - Fork 81
/
preset.sh
executable file
·215 lines (196 loc) · 6.04 KB
/
preset.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/usr/bin/env bash
set -ex
check_os() {
if [[ "$(uname -v)" == *"Linux"* ]] ; then
PKG="linux" # linux is my default
echo "Running on Linux"
elif [[ "$(uname -v)" == *"Ubuntu"* ]] ; then
PKG="Ubuntu"
echo "Running on Ubuntu"
else
echo "Unknown operating system"
echo "Please select your operating system"
echo "Choices:"
echo " linux - any linux distro"
echo " darwin - MacOS"
read PKG
fi
}
update() {
echo -e "Start to update && upgrade"
if [ $PKG = "Ubuntu" ] ; then
sudo apt update -y && sudo apt upgrade -y
elif [ $PKG = "Debian" ] ; then
yum apt update -y && sudo apt upgrade -y
fi
echo -e "Update && upgrade finished"
}
install_python3() {
echo "Start to install python3"
if [ $PKG = "Ubuntu" ] ; then
sudo apt-get install python3
elif [ $PKG = "Debian" ] ; then
yum apt-get install python3
fi
python3 -V
echo "Python3 installed"
}
install_clang() {
echo "Start to install clang"
if [ $PKG = "Ubuntu" ] ; then
sudo apt-get install clang -y
elif [ $PKG = "Debian" ] ; then
yum apt-get install clang -y
fi
clang -v
echo "clang installed"
}
install_gccgo() {
echo "Start to install gccgo"
if [ $PKG = "Ubuntu" ] ; then
sudo apt-get install gccgo -y
elif [ $PKG = "Debian" ] ; then
yum apt-get install gccgo -y
fi
gccgo -V
echo "gccgo installed"
}
install_golang() {
echo "Start to install gccgo"
if [ $PKG = "Ubuntu" ] ; then
sudo apt-get install golang
elif [ $PKG = "Debian" ] ; then
yum apt-get install golang
fi
go version
echo "gccgo installed"
}
install_rust() {
echo "Start to install rust"
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
rustup -V
rustc -V
cargo -V
echo "rust installed"
}
install_openssl() {
echo "Start to install the dev package of openssl"
if [ $PKG = "Ubuntu" ] ; then
sudo apt-get install libssl-dev -y
sudo apt install libssl-dev -y
elif [ $PKG = "Debian" ] ; then
yum apt-get install libssl-dev -y
yum apt install libssl-dev -y
fi
apt-cache search libssl-dev
echo "openssl installed"
}
install_pkgconfig() {
echo "Start to install the pkg-config"
if [ $PKG = "Ubuntu" ] ; then
sudo apt-get install pkg-config -y
sudo apt install pkg-config -y
elif [ $PKG = "Debian" ] ; then
yum apt-get install pkg-config -y
yum apt install pkg-config -y
fi
apt-cache search pkg-config
echo "openssl installed"
}
install_zlib1g_dev() {
echo "Start to install the zlib1g-dev"
if [ $PKG = "Ubuntu" ] ; then
sudo apt-get install zlib1g-dev -y
sudo apt install zlib1g-dev -y
elif [ $PKG = "Debian" ] ; then
yum apt-get install zlib1g-dev -y
yum apt install zlib1g-dev -y
fi
apt-cache search zlib1g-dev
echo "zlib1g-dev installed"
}
install_influxdb() {
echo "Start to install influxdb"
if [ $PKG = "Ubuntu" ] ; then
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/lsb-release
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt-get install influxdb
influxd config
elif [ $PKG = "Debian" ] ; then
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/os-release
test $VERSION_ID = "7" && echo "deb https://repos.influxdata.com/debian wheezy stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "8" && echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt-get install influxdb
influxd config
fi
influxd version
echo "influxdb installed"
}
install_SNAP() {
echo "Start to install SNAP"
if [ $PKG = "Ubuntu" ] ; then
sudo apt install snapd
elif [ $PKG = "Debian" ] ; then
yum apt install snapd
fi
snap version
echo "SNAP installed"
}
install_nodejs(){
echo "Start to install nodejs10"
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt-get install -y nodejs
node --version
npm --version
}
install_yarn(){
echo "Start to install nodejs10"
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
apt-get update -qq
apt-get install -y yarn
yarn --version
}
install_redis(){
echo "Start to install redis"
[[ $(uname) = Linux ]] || exit 1
[[ $USER = root ]] || exit 1
apt-get --assume-yes install redis
}
install_python_module(){
echo "Start to install Python Modules"
[[ $(uname) = Linux ]] || exit 1
[[ $USER = root ]] || exit 1
pip3 install colorama
pip3 install click
}
check_os
echo "----------------------------------------------------------------------------------------"
update
echo "----------------------------------------------------------------------------------------"
install_python3
echo "----------------------------------------------------------------------------------------"
install_clang
echo "----------------------------------------------------------------------------------------"
install_golang
echo "----------------------------------------------------------------------------------------"
install_rust
echo "----------------------------------------------------------------------------------------"
install_openssl
echo "----------------------------------------------------------------------------------------"
install_influxdb
echo "----------------------------------------------------------------------------------------"
install_pkgconfig
echo "----------------------------------------------------------------------------------------"
install_zlib1g_dev
echo "----------------------------------------------------------------------------------------"
install_nodejs
echo "----------------------------------------------------------------------------------------"
install_yarn
echo "----------------------------------------------------------------------------------------"
install_redis
echo "----------------------------------------------------------------------------------------"
install_python_module