forked from Aquila-Network/aquila
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·128 lines (105 loc) · 2.93 KB
/
install.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
#!/bin/bash -e
export DEBIAN_FRONTEND=noninteractive
apt update
export USER=$(whoami)
export ROOT_DIR=/home/$USER
mkdir -p /data/
mkdir -p $ROOT_DIR
cd $ROOT_DIR
mini=1
gpu=0
test=0
demon=0
while getopts m:g:t:d: flag
do
case "${flag}" in
m) mini=${OPTARG};;
g) gpu=${OPTARG};;
t) test=${OPTARG};;
d) demon=${OPTARG};;
esac
done
if [[ $mini -eq 1 ]]; # if minimal install enabled
then
echo "Aquila DB minimal install will be done by default. \
Minimal install is recommended for personal use - \
install process is fast and lightweight. If you are planning to deal \
with big-data, disable minimal install with '-m 0' argument"
fi
# system packs install
apt install -y git wget nano python3.8 python3-pip libssl-dev
if [[ $mini -eq 0 ]]; # if minimal install disabled
then
apt install -y libblas-dev liblapack-dev swig
fi
# setup venv
pip3 install virtualenv
virtualenv $ROOT_DIR/env
source $ROOT_DIR/env/bin/activate
# install python packages
pip3 install numpy pycryptodome base58 chardet Flask requests flask_cors PyYAML bson fastjsonschema annoy plyvel
if [[ $mini -eq 0 ]]; # if minimal install disabled
then
# install cmake
apt purge --auto-remove cmake
version=3.19
build=1
mkdir -p $ROOT_DIR/temp
cd $ROOT_DIR/temp
wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz
tar -xzvf cmake-$version.$build.tar.gz
cd cmake-$version.$build/
./bootstrap
make -j$(nproc)
make install
cmake --version
# install faiss
cd $ROOT_DIR
mkdir -p faiss
cd faiss
git clone https://github.com/facebookresearch/faiss.git .
if [[ $gpu -eq 0 ]]; # if gpu not enabled
then
echo "build FAISS without GPU"
cmake -DFAISS_ENABLE_GPU=OFF -B build .
else
echo "build FAISS with GPU"
cmake -B build .
fi
make -C build
# For the Python interface:
cd build/faiss/python
python setup.py install
cp -r $ROOT_DIR/faiss/build/faiss/python/ $ROOT_DIR/env/lib/python3.8/site-packages/faiss
fi
# clone & test AquilaDB
cd $ROOT_DIR
mkdir -p adb
cd adb
git clone https://github.com/Aquila-Network/AquilaDB.git .
mkdir -p /ossl/
openssl genrsa -passout pass:1234 -des3 -out /ossl/private.pem 2048
openssl rsa -passin pass:1234 -in /ossl/private.pem -outform PEM -pubout -out /ossl/public.pem
openssl rsa -passin pass:1234 -in /ossl/private.pem -out /ossl/private_unencrypted.pem -outform PEM
cd $ROOT_DIR/adb/src
if [[ $test -eq 1 ]]; # if tests enabled
then
chmod +x run_tests.sh
./run_tests.sh
else
echo "Not running tests"
fi
echo "==================================="
echo " AquilaDB setup complete. "
echo "==================================="
if [[ $demon -eq 1 ]]; # if demon run enabled
then
# install node
apt install -y nodejs npm
# install pm2
npm i pm2 -g
# start server
pm2 start index.py
# Keep logs alive
pm2 logs -f
fi