【问题标题】:Failed to install mongoDB in Ubuntu 20.04在 Ubuntu 20.04 中安装 mongoDB 失败
【发布时间】:2021-11-05 04:26:47
【问题描述】:

我尝试在ubuntu 20.04上安装MongoDB,使用的命令如下,

在sources.list.d文件夹中创建一个mongodb-org-4.4.list文件

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

在我的系统上安装 MongoDB,

sudo apt install mongodb-org

运行上述命令后,我遇到了一个错误,它没有安装在ubuntu系统中,错误如下,请关注谁想帮助我,

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).

注意:该错误也在附件中添加。

【问题讨论】:

标签: reactjs mongodb ubuntu backend


【解决方案1】:

这样试试

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 install -y mongodb-org

【讨论】:

    【解决方案2】:

    @Alex Blex,请关注这里,

    >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 install mongodb-org
    

    运行上述命令后,我还运行apt --fix-broken install这个命令,它显示一个错误,即,

    E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
    E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
    

    然后我在我的笔记本电脑中创建了一个新的director,名称为/var/lib/dpkg/lock-frontend,但是没有解决。

    即使我也在你的建议之后运行sudo apt-get --purge remove mongodb-org这个命令,然后再次运行所有命令,但它再次显示同样的问题。

    在运行sudo apt-get --purge remove mongodb-org这个命令后显示如下反馈,请关注这里,

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    You might want to run 'apt --fix-broken install' to correct these.
    The following packages have unmet dependencies:
     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).
    

    谢谢大家!

    【讨论】:

    • 我也有同样的问题。
    【解决方案3】:

    试试这个命令:

    sudo apt-get install -y mongodb-org
    

    我用它来安装 MongoDB,它正在工作:

    教程:https://addi-kamal.medium.com/mongodb-iceberg-how-to-install-mongodb-on-ubuntu-server-9c5beea2c62

    【讨论】:

      猜你喜欢
      • 2022-12-04
      • 1970-01-01
      • 2020-09-06
      • 1970-01-01
      • 2020-08-07
      • 1970-01-01
      • 2021-02-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多