在 ubuntu 20.04 中安装 mongodb 时出错

在 ubuntu 20.04 中安装 mongodb 时出错
Reading package lists... Done
Building dependency tree       
Reading state information... Done
mongodb-org is already the newest version (4.4.5).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 mongodb-org : Depends: mongodb-org-server but it is not going to be installed
               Depends: mongodb-org-mongos but it is not going to be installed
 mongodb-org-tools : Depends: mongodb-database-tools but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

答案1

首先删除 mongodb 的所有 PPA 存储库,然后:

sudo apt-get purge mongodb-org*
sudo apt remove mongodb
sudo apt purge mongodb
sudo apt autoremove
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
sudo apt-get install gnupg
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
sudo apt-get upgrade
sudo apt update
sudo apt upgrade
sudo apt-get install -y mongodb-org
sudo apt-get install libc6
sudo service mongod start
sudo service mongod status

这对我解决这个问题有帮助。

该解决方案取自这里

相关内容