thelinuxlist/scripts/mongodbinstall.sh

31 lines
1.0 KiB
Bash
Raw Permalink Normal View History

2022-10-19 21:53:10 -07:00
#!/bin/bash
2022-10-20 11:01:07 -07:00
while true
do
read -r -p "Would you like to install MongoDB? [Y/n] " input
case $input in
[yY][eE][sS]|[yY])
break
;;
[nN][oO]|[nN])
break
;;
*)
2022-10-20 11:03:05 -07:00
echo "That wasn't an option..."
2022-10-20 11:01:07 -07:00
;;
esac
2022-10-19 21:53:10 -07:00
done
sudo apt update && apt upgrade -y
sudo apt install wget curl gnupg2 software-properties-common apt-transport-https ca-certificates lsb-release
sudo curl -fsSL https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
2022-10-19 21:59:42 -07:00
echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list
2022-10-19 21:53:10 -07:00
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
2022-10-19 21:59:42 -07:00
sudo apt update -y
sudo apt-get install libssl1.1 -y
2022-10-19 21:53:10 -07:00
sudo apt install mongodb-org -y
sudo systemctl start mongod
2022-10-19 22:00:52 -07:00
sudo systemctl enable mongod
apt autoremove -y