-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-mongodb7.sh
executable file
·53 lines (45 loc) · 1.53 KB
/
install-mongodb7.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
#!/bin/bash
echo "This script installs MongoDB 7.0 from it's own repositories"
read -p "Do you want to continue? [Y/n] " yn
case $yn in
[yY] ) ;;
* ) echo Abort.; exit;;
esac
echo "apt update is done...";
apt update
echo "apt update done!";
read -p "Do you want to do a dist-upgrade first? [Y/n] " yn
case $yn in
[yY] )
echo "dist-upgrade is done...";
apt dist-upgrade -y;
echo "dist-upgrade done!";;
esac
read -p "Do you want to install curl, htop, pwgen, zip, unzip, whois, net-tools and dnsutils? [Y/n] " yn
case $yn in
[yY] )
echo "packages are installed...";
for package in curl htop pwgen zip unzip whois net-tools dnsutils; do
if ! dpkg -l "$package" | grep -q ^ii; then
apt install -y "$package"
fi
done;
echo "installation done!";;
esac
echo "gnupg, ca-certificates and apt-transport-https are installed..."
for package in gnupg ca-certificates apt-transport-https; do
if ! dpkg -l "$package" | grep -q ^ii; then
apt install -y "$package"
fi
done
echo "installation done!"
echo "MongoDB 7.0 repo key is downloaded and added..."
wget -qO - https://pgp.mongodb.com/server-7.0.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/mongodb-org-7.0.gpg
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-7.0.list
echo "download and adding done!";
echo "apt update is done (again)...";
apt update
echo "apt update done!";
echo "MongoDB 7.0 is installed...";
apt install -y mongodb-org
echo "installation done!";