Fix install of mongodb on Ubuntu 22.04

Simplify the version check to make it less error prone, use the right
version of the 22.04 repository from mongodb.org (jammy vs focal) and
stop trying to install libssl package that no longer exists on the
repository.

Change-Id: I49d32e555e6a0df15c0e059e8c4152a969ab3975
This commit is contained in:
Martin André 2023-03-07 19:22:10 +01:00 committed by wanghao
parent 5a7636786e
commit 54aed6be0f
2 changed files with 6 additions and 6 deletions

View File

@ -176,10 +176,10 @@ function configure_mongodb {
pip_install pymongo
if is_ubuntu; then
# NOTE: To fix the mongodb's issue in ubuntu 22.04 LTS
ubuntu_version=`cat /etc/issue | cut -d " " -f2`
if [[ $ubuntu_version > '22' ]]; then
ubuntu_version=$(source /etc/os-release ; echo $VERSION_ID)
if [[ $ubuntu_version == '22.04' ]]; then
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
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
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt update
curl -LO http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.21_amd64.deb
sudo dpkg -i ./libssl1.1_1.1.1-1ubuntu2.1~18.04.21_amd64.deb

View File

@ -33,10 +33,10 @@ mysql -u $DB_USER -p$DB_PW -h 127.0.0.1 -e "
CREATE DATABASE openstack_citest CHARACTER SET utf8;"
# TO fix the mongodb issue in ubuntu 22.04
ubuntu_version=`cat /etc/issue | cut -d " " -f2`
if [[ $ubuntu_version > '22' ]]; then
ubuntu_version=$(source /etc/os-release ; echo $VERSION_ID)
if [[ $ubuntu_version == '22.04' ]]; then
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
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
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt update
curl -LO http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.21_amd64.deb
sudo dpkg -i ./libssl1.1_1.1.1-1ubuntu2.1~18.04.21_amd64.deb