This commit is contained in:
BoHung Chiu 2023-04-20 10:40:48 +08:00
parent e2ee286ade
commit c2a0f46cb7
1 changed files with 7 additions and 9 deletions

View File

@ -75,7 +75,7 @@ function get_mongodb_old(){
mongodb_old_dir="/var/lib/$old_dir"
}
function fix_downgrade_mongod(){
if [ -z "$org_mongod_ver" ]
if [ -z "$org_mongod_ver" ]; then
sudo rm -rf /var/lib/mongodb/*;
sudo chown mongodb:mongodb /var/lib/mongodb -R
sudo chown mongodb:mongodb /var/log/mongodb -R
@ -102,6 +102,12 @@ function install_mongodb(){
if [[ "$2" == "1" ]]; then #reinstall
sudo rm -f /etc/apt/sources.list.d/mongodb-org-*
fi
if [[ "$ubuntu_version" > '20' ]]; then
sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1f-1ubuntu2_amd64.deb
sudo dpkg -i libssl-dev_1.1.1f-1ubuntu2_amd64.deb
fi
case $1 in
3.2)
mongod_ver="3.2.22"
@ -158,10 +164,6 @@ function install_mongodb(){
apt_add_key_func https://www.mongodb.org/static/pgp/server-5.0.asc
# install mongod 5.0
if [[ "$ubuntu_version" > '20' ]]; then
sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
sudo dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
sudo dpkg -i libssl-dev_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
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
elif [[ "$ubuntu_version" =~ '18' ]] || [[ "$ubuntu_version" =~ '19' ]]; then
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
@ -197,10 +199,6 @@ function install_mongodb(){
mongod_ver="6.0.4"
apt_add_key_func https://www.mongodb.org/static/pgp/server-6.0.asc
if [[ "$ubuntu_version" > '20' ]]; then
sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
sudo dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
sudo dpkg -i libssl-dev_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
elif [[ "$ubuntu_version" =~ '18' ]] || [[ "$ubuntu_version" =~ '19' ]]; then
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list