-
Notifications
You must be signed in to change notification settings - Fork 0
/
__install_3rd_party.sh
105 lines (99 loc) · 3.5 KB
/
__install_3rd_party.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
#!/bin/bash
echo -e "
A script that installs MongoDB, PyMongo and Streamlit.
Version: v3.0
Dependencies: -
Author: Platon Bykadorov ([email protected]), 2022
License: GNU General Public License version 3
Donate: https://www.tinkoff.ru/rm/bykadorov.platon1/7tX2Y99140/
Documentation: https://github.com/PlatonB/high-perf-bio/blob/master/README-EN.md
Bug reports, suggestions, talks: https://github.com/PlatonB/high-perf-bio/issues
Notation:
y - type y to confirm this action;
<enter> - type anything other than y or
type nothing to discard this action.\n"
#Определение дистрибутива.
#Грязный хак для Fedora.
#Текущая версия MongoDB.
distro_name=$(cat /etc/os-release |
grep -Po "(?<=^ID=).+" |
grep -Po "\w+" |
head -1)
ubuntu_family=(elementary linuxmint neon ubuntu)
redhat_family=(almalinux centos fedora rhel rocky)
for name in ${ubuntu_family[@]}
do
if [[ $name == $distro_name ]]; then
distro_name=ubuntu
ubuntu_debian_ver=$(cat /etc/os-release |
grep -Po "(?<=^UBUNTU_CODENAME=).+")
ubuntu_debian_repo=multiverse
break
fi
done
if [[ $distro_name == debian ]]; then
ubuntu_debian_ver=$(cat /etc/os-release |
grep -Po "(?<=^VERSION_CODENAME=).+")
ubuntu_debian_repo=main
fi
for name in ${redhat_family[@]}
do
if [[ $name == $distro_name ]]; then
if [[ $distro_name == fedora ]]; then
rhel_ver=9
else
rhel_ver=$(cat /etc/os-release |
grep -Po "(?<=^VERSION_ID=).+" |
grep -Po "\d+" |
head -1)
fi
distro_name=rhel
break
fi
done
mongodb_ver=6.0
#Дистро-специфичные команды.
if [[ $distro_name == ubuntu ]] || [[ $distro_name == debian ]]; then
if [[ $ubuntu_debian_ver == jammy ]]; then
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
sudo apt install ./libssl1.1_1.1.1f-1ubuntu2_amd64.deb; echo
rm -v libssl1.1_1.1.1f-1ubuntu2_amd64.deb; echo
fi
wget -qO - https://www.mongodb.org/static/pgp/server-$mongodb_ver.asc |
sudo apt-key add -; echo
echo deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/$distro_name $ubuntu_debian_ver/mongodb-org/$mongodb_ver $ubuntu_debian_repo |
sudo tee /etc/apt/sources.list.d/mongodb-org-$mongodb_ver.list; echo
sudo apt update; echo
sudo apt install -y mongodb-org; echo
sudo apt install -y python3-pip; echo
elif [[ $distro_name == rhel ]]; then
echo "[mongodb-org-$mongodb_ver]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$rhel_ver/mongodb-org/$mongodb_ver/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-$mongodb_ver.asc" |
sudo tee /etc/yum.repos.d/mongodb-org-$mongodb_ver.repo; echo
sudo yum install -y mongodb-org; echo
sudo dnf install -y python3-pip; echo
elif [[ $distro_name == opensuse ]]; then
sudo rpm --import https://www.mongodb.org/static/pgp/server-$mongodb_ver.asc
sudo zypper addrepo --gpgcheck https://repo.mongodb.org/zypper/suse/15/mongodb-org/$mongodb_ver/x86_64/ mongodb; echo
sudo zypper -n install mongodb-org; echo
else
echo -e "Automatic dependencies installation
on $distro_name is not supported yet.\n"
exit
fi
#Кросс-дистрибутивные команды.
sudo systemctl enable mongod
if [[ -d ~/miniconda3/ ]]; then
conda install -y streamlit; echo
else
pip3 install streamlit; echo
fi
pip3 install pymongo; echo
read -p "Reboot OS now? (recommended) (y/<enter>): " reboot; echo
if [[ $reboot == y ]]; then
sudo systemctl reboot
fi