-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
install-dependencies.sh
executable file
·348 lines (324 loc) · 9.65 KB
/
install-dependencies.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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
#!/bin/bash -e
#
# This file is open source software, licensed to you under the terms
# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
# distributed with this work for additional information regarding copyright
# ownership. You may not use this file except in compliance with the License.
#
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# os-release may be missing in container environment by default.
if [ -f "/etc/os-release" ]; then
. /etc/os-release
elif [ -f "/etc/arch-release" ]; then
export ID=arch
else
echo "/etc/os-release missing."
exit 1
fi
debian_base_packages=(
clang
gdb
liblua5.3-dev
python3-aiohttp
python3-pyparsing
python3-colorama
python3-tabulate
libsnappy-dev
libjsoncpp-dev
rapidjson-dev
scylla-libthrift010-dev
scylla-antlr35-c++-dev
thrift-compiler
git
pigz
libunistring-dev
libzstd-dev
libdeflate-dev
libabsl-dev
)
fedora_packages=(
clang
gdb
lua-devel
yaml-cpp-devel
thrift-devel
antlr3-tool
antlr3-C++-devel
jsoncpp-devel
rapidjson-devel
snappy-devel
libdeflate-devel
systemd-devel
abseil-cpp-devel
git
python
sudo
java-1.8.0-openjdk-headless
java-1.8.0-openjdk-devel
ant
ant-junit
maven
patchelf
python3
python3-aiohttp
python3-pip
python3-magic
python3-colorama
python3-tabulate
python3-boto3
python3-pytest
python3-pytest-asyncio
python3-redis
dnf-utils
pigz
net-tools
tar
gzip
gawk
util-linux
ethtool
hwloc
glibc-langpack-en
xxhash-devel
makeself
libzstd-static libzstd-devel
rpm-build
devscripts
debhelper
fakeroot
file
dpkg-dev
curl
rust
cargo
)
# lld is not available on s390x, see
# https://src.fedoraproject.org/rpms/lld/c/aa6e69df60747496f8f22121ae8cc605c9d3498a?branch=rawhide
if [ "$(uname -m)" != "s390x" ]; then
fedora_packages+=(lld)
fi
fedora_python3_packages=(
python3-pyyaml
python3-urwid
python3-pyparsing
python3-requests
python3-pyudev
python3-setuptools
python3-psutil
python3-distro
python3-click
python3-six
)
pip_packages=(
scylla-driver
geomet
traceback-with-variables
scylla-api-client
)
pip_symlinks=(
scylla-api-client
)
centos_packages=(
gdb
yaml-cpp-devel
thrift-devel
scylla-antlr35-tool
scylla-antlr35-C++-devel
jsoncpp-devel snappy-devel
rapidjson-devel
scylla-boost163-static
scylla-python34-pyparsing20
systemd-devel
pigz
)
# 1) glibc 2.30-3 has sys/sdt.h (systemtap include)
# some old containers may contain glibc older,
# so enforce update on that one.
# 2) if problems with signatures, ensure having fresh
# archlinux-keyring: pacman -Sy archlinux-keyring && pacman -Syyu
# 3) aur installations require having sudo and being
# a sudoer. makepkg does not work otherwise.
#
# aur: antlr3, antlr3-cpp-headers-git
arch_packages=(
gdb
base-devel
filesystem
git
glibc
jsoncpp
lua
python-pyparsing
python3
rapidjson
snappy
thrift
)
NODE_EXPORTER_VERSION=1.4.0
declare -A NODE_EXPORTER_CHECKSUM=(
["x86_64"]=e77ff1b0a824a4e13f82a35d98595fe526849c09e3480d0789a56b72242d2abc
["aarch64"]=0b20aa75385a42857a67ee5f6c7f67b229039a22a49c5c61c33f071356415b59
["s390x"]=a98e2aa5f9e557441190d233ba752c0cae28f3130c6a6742b038f3997d034065
)
declare -A NODE_EXPORTER_ARCH=(
["x86_64"]=amd64
["aarch64"]=arm64
["s390x"]=s390x
)
NODE_EXPORTER_DIR=/opt/scylladb/dependencies
node_exporter_filename() {
echo "node_exporter-$NODE_EXPORTER_VERSION.linux-${NODE_EXPORTER_ARCH["$(arch)"]}.tar.gz"
}
node_exporter_fullpath() {
echo "$NODE_EXPORTER_DIR/$(node_exporter_filename)"
}
node_exporter_checksum() {
sha256sum "$(node_exporter_fullpath)" | while read -r sum _; do [[ "$sum" == "${NODE_EXPORTER_CHECKSUM["$(arch)"]}" ]]; done
}
node_exporter_url() {
echo "https://github.com/prometheus/node_exporter/releases/download/v$NODE_EXPORTER_VERSION/$(node_exporter_filename)"
}
print_usage() {
echo "Usage: install-dependencies.sh [OPTION]..."
echo ""
echo " --print-python3-runtime-packages Print required python3 packages for Scylla"
echo " --print-pip-runtime-packages Print required pip packages for Scylla"
echo " --print-pip-symlinks Print list of pip provided commands which need to install to /usr/bin"
echo " --print-node-exporter-filename Print node_exporter filename"
exit 1
}
PRINT_PYTHON3=false
PRINT_PIP=false
PRINT_PIP_SYMLINK=false
PRINT_NODE_EXPORTER=false
while [ $# -gt 0 ]; do
case "$1" in
"--print-python3-runtime-packages")
PRINT_PYTHON3=true
shift 1
;;
"--print-pip-runtime-packages")
PRINT_PIP=true
shift 1
;;
"--print-pip-symlinks")
PRINT_PIP_SYMLINK=true
shift 1
;;
"--print-node-exporter-filename")
PRINT_NODE_EXPORTER=true
shift 1
;;
*)
print_usage
;;
esac
done
if $PRINT_PYTHON3; then
if [ "$ID" != "fedora" ]; then
echo "Unsupported Distribution: $ID"
exit 1
fi
echo "${fedora_python3_packages[@]}"
exit 0
fi
if $PRINT_PIP; then
echo "${pip_packages[@]}"
exit 0
fi
if $PRINT_PIP_SYMLINK; then
echo "${pip_symlinks[@]}"
exit 0
fi
if $PRINT_NODE_EXPORTER; then
node_exporter_fullpath
exit 0
fi
./seastar/install-dependencies.sh
./tools/jmx/install-dependencies.sh
./tools/java/install-dependencies.sh
if [ "$ID" = "ubuntu" ] || [ "$ID" = "debian" ]; then
apt-get -y install "${debian_base_packages[@]}"
if [ "$VERSION_ID" = "8" ]; then
apt-get -y install libsystemd-dev scylla-antlr35 libyaml-cpp-dev
elif [ "$VERSION_ID" = "14.04" ]; then
apt-get -y install scylla-antlr35 libyaml-cpp-dev
elif [ "$VERSION_ID" = "9" ]; then
apt-get -y install libsystemd-dev antlr3 scylla-libyaml-cpp05-dev
else
apt-get -y install libsystemd-dev antlr3 libyaml-cpp-dev
fi
echo -e "Configure example:\n\t./configure.py --enable-dpdk --mode=release --static-thrift --static-boost --static-yaml-cpp --compiler=/opt/scylladb/bin/g++-7 --cflags=\"-I/opt/scylladb/include -L/opt/scylladb/lib/x86-linux-gnu/\" --ldflags=\"-Wl,-rpath=/opt/scylladb/lib\""
elif [ "$ID" = "fedora" ]; then
if rpm -q --quiet yum-utils; then
echo
echo "This script will install dnf-utils package, witch will conflict with currently installed package: yum-utils"
echo "Please remove the package and try to run this script again."
exit 1
fi
dnf install -y "${fedora_packages[@]}" "${fedora_python3_packages[@]}"
PIP_DEFAULT_ARGS="--only-binary=:all: -v"
pip3 install "$PIP_DEFAULT_ARGS" "geomet<0.3,>=0.1"
pip3 install "$PIP_DEFAULT_ARGS" scylla-driver
pip3 install "$PIP_DEFAULT_ARGS" traceback-with-variables
pip3 install "$PIP_DEFAULT_ARGS" scylla-api-client
cargo --config net.git-fetch-with-cli=true install cxxbridge-cmd --root /usr/local
if [ -f "$(node_exporter_fullpath)" ] && node_exporter_checksum; then
echo "$(node_exporter_filename) already exists, skipping download"
else
mkdir -p "$NODE_EXPORTER_DIR"
curl -fSL -o "$(node_exporter_fullpath)" "$(node_exporter_url)"
if ! node_exporter_checksum; then
echo "$(node_exporter_filename) download failed"
exit 1
fi
fi
elif [ "$ID" = "centos" ]; then
dnf install -y "${centos_packages[@]}"
echo -e "Configure example:\n\tpython3.4 ./configure.py --enable-dpdk --mode=release --static-boost --compiler=/opt/scylladb/bin/g++-7.3 --python python3.4 --ldflag=-Wl,-rpath=/opt/scylladb/lib64 --cflags=-I/opt/scylladb/include --with-antlr3=/opt/scylladb/bin/antlr3"
elif [ "$ID" == "arch" ]; then
# main
if [ "$EUID" -eq "0" ]; then
pacman -Sy --needed --noconfirm "${arch_packages[@]}"
else
echo "scylla: You now ran $0 as non-root. Run it again as root to execute the pacman part of the installation." 1>&2
fi
# aur
if [ ! -x /usr/bin/antlr3 ]; then
echo "Installing aur/antlr3..."
if (( EUID == 0 )); then
echo "You now ran $0 as root. This can only update dependencies with pacman. Please run again it as non-root to complete the AUR part of the installation." 1>&2
exit 1
fi
TEMP=$(mktemp -d)
pushd "$TEMP" > /dev/null || exit 1
git clone --depth 1 https://aur.archlinux.org/antlr3.git
cd antlr3 || exit 1
makepkg -si
popd > /dev/null || exit 1
fi
if [ ! -f /usr/include/antlr3.hpp ]; then
echo "Installing aur/antlr3-cpp-headers-git..."
if (( EUID == 0 )); then
echo "You now ran $0 as root. This can only update dependencies with pacman. Please run again it as non-root to complete the AUR part of the installation." 1>&2
exit 1
fi
TEMP=$(mktemp -d)
pushd "$TEMP" > /dev/null || exit 1
git clone --depth 1 https://aur.archlinux.org/antlr3-cpp-headers-git.git
cd antlr3-cpp-headers-git || exit 1
makepkg -si
popd > /dev/null || exit 1
fi
echo -e "Configure example:\n\t./configure.py\n\tninja release"
fi