在ubuntu 16.04上安装mongodb时出错

时间:2017-09-25 11:54:54

标签: linux mongodb ubuntu ubuntu-16.04

我已经看到了这些答案,所以请不要在解决方案中链接em:

  

Installing MongoDB on Ubuntu 16.04   https://unix.stackexchange.com/questions/220467/mongodb-unmet-dependencies/220483   can't install mongodb on ubuntu 16.10   https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04

我已经为ubuntu 16.04添加了必需的存储库

当我运行sudo apt-get install -y mongodb-org时,它会抛出错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
linux-headers-4.4.0-93-generic : Depends: linux-headers-4.4.0-93 but it is not going to be installed
mongodb-org : Depends: mongodb-org-shell but it is not going to be installed
               Depends: mongodb-org-server but it is not going to be installed
               Depends: mongodb-org-mongos but it is not going to be installed
               Depends: mongodb-org-tools but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

在运行apt-get -f install时,我收到以下错误:

Unpacking linux-headers-4.4.0-93 (4.4.0-93.116) ...
dpkg: error processing archive /var/cache/apt/archives/linux-headers-4.4.0-93_4.4.0-93.116_all.deb (--unpack):
unable to create '/usr/src/linux-headers-4.4.0-93/arch/xtensa/include/asm/pgtable.h.dpkg-new' (while processing './usr/src/linux-headers-4.4.0-93/arch/xtensa/include/asm/pgtable.h'): No space left on device
No apport report written because the error message indicates a disk full error
                                                                          dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/linux-headers-4.4.0-93_4.4.0-93.116_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

当我再次尝试安装时,同样的事情仍在继续。

任何人都可以解释这个错误是什么以及如何安装它吗?

更新

正在运行df -h

Filesystem      Size  Used Avail Use% Mounted on
udev            487M     0  487M   0% /dev
tmpfs           100M   12M   88M  12% /run
/dev/xvda1      7.8G  5.3G  2.1G  72% /
tmpfs           496M     0  496M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           496M     0  496M   0% /sys/fs/cgroup
tmpfs           100M     0  100M   0% /run/user/1000

正在运行df -i

Filesystem     Inodes  IUsed  IFree IUse% Mounted on
udev           124466    360 124106    1% /dev
tmpfs          126788    480 126308    1% /run
/dev/xvda1     524288 520744   3544  100% /
tmpfs          126788      1 126787    1% /dev/shm
tmpfs          126788      6 126782    1% /run/lock
tmpfs          126788     16 126772    1% /sys/fs/cgroup
tmpfs          126794      4 126790    1% /run/user/1000

11 个答案:

答案 0 :(得分:10)

在安装libcurl3

后工作

sudo apt install libcurl3

答案 1 :(得分:5)

我也遇到了类似的问题,这样做可以为我解决 转到此目录/etc/apt/sources.list.d/,并检查是否还有其他mongodb-org-*。list文件,因为这会引起冲突。

然后尝试再次安装它,如果再次出现问题,请运行

sudo apt purge mongod* sudo apt purge mongodb* sudo apt purge mongodb-org*

要删除所有不一致之处,然后转到https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/并按照以下步骤进行操作。

如果您使用的是Linux Mint,Ubuntu GNOME等Ubuntu衍生产品,请在粘贴所需命令之前,确保Wiki的ubuntu衍生版本上正在运行哪个Ubuntu版本。 在我的情况下,我使用的是Linux Mint 17-> Ubuntu 14.04,而我正在安装的Ubuntu 16.04导致冲突

希望这可以解决问题。

答案 2 :(得分:2)

您完成了更新吗?

sudo apt-get update && sudo apt-get upgrade

如果更新没有帮助,请尝试检查损坏的依赖项:

sudo apt-get check

check命令是一种诊断工具。它用于更新包缓存并检查损坏的依赖关系。

我还会尝试两件事。 首先,

sudo dpkg --configure -a
sudo apt-get -f install

如果这没有帮助,请尝试取消阻止dpkg

sudo rm -rf /var/lib/apt/lists/partial/*
sudo apt-get -f install

我希望它有所帮助。

答案 3 :(得分:2)

  • 下载MongoDB社区服务器(.dbz)版本

  • 提取并将其移至主目录

  • 通过运行以下命令编辑〜/ .profile:

    • gedit ~/.profile
  • 然后添加此内容:

    • echo export PATH=mongodb-linux-x86_64-ubuntu1804-4.0.4/bin:$PATH
  • 保存,然后运行以下命令来更新系统变量:

    • source ~/.profile
  • 然后,通过运行以下命令启动服务器:

    • mongod

答案 4 :(得分:1)

运行以下命令:

  

sudo apt-get -f install

然后尝试运行sudo apt-get install -y mongodb-org

答案 5 :(得分:1)

我尝试了很多答案,但最后我发现make系统版本与mongo repo所需版本不匹配。在MongoDB官方网站上,有一个选项可以让您选择正确的回购链接。 因此,请首先使用以下命令检查系统版本:

lsb_release -dc

然后,如果您的系统版本为18.04,请尝试

echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list

如果您的系统版本是16.04,请尝试

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list

答案 6 :(得分:1)

我遇到了同样的问题。我尝试使用 brew 安装,但它对我不起作用。我按照官网提到的所有步骤都做了,但是没有用。

Error in installing mongodb

我为 MongoDB 创建了一个特定的 sources.list 文件,并将其添加到 apt 始终使用的 sources.list 目录中。确保使用与 sources.list 相同的格式

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

接下来,我们需要更新以使apt使用更新的sources.list。所以我使用了更新命令。

sudo apt-get update

最后,我执行了安装命令并且成功了。

Solution of the error

答案 7 :(得分:0)

您是否检查过服务器上的inode? return可能仍然显示空间,但您可能没有inode。请尝试运行df -h并查看服务器上是否还有任何inode。

答案 8 :(得分:0)

 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6

echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start
mongo

答案 9 :(得分:0)

用于在Ubuntu 16.04中安装mongodb 4.0

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 68818C72E52529D4

回显“ deb [arch = amd64,arm64] https://repo.mongodb.org/apt/ubuntu xenial / mongodb-org / 4.0 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list

sudo apt安装libcurl3

sudo apt-get更新

sudo服务mongod启动

mongo

答案 10 :(得分:0)

使用此命令删除这些文件。

sudo dpkg -i --force-overwrite /var/cache/apt/archives/mongodb-org-mongos_4.4.4_amd64.deb; sudo dpkg -i --force-overwrite /var/cache/apt/archives/mongodb-org-server_4.4.4_amd64.deb; sudo dpkg -i --force-overwrite /var/cache/apt/archives/mongodb-org-tools;

然后运行

sudo apt-get install -y mongodb-org;

sudo systemctl start mongod;