ubuntu安装mongodb失败

root@jdu4e00u53f7:~/web21# sudo apt-get install mongodb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mongodb : Depends: mongodb-dev but it is not going to be installed
           Depends: mongodb-server (>= 1:2.4.1-2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我想使用sudo apt-get install mongodb命令来在ubuntu安装mongodb但是不成功

我的源是163的源

root@jdu4e00u53f7:/etc# cat hosts
127.0.0.1       localhost jdu4e00u53f7
127.0.1.1       ubuntu

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
root@jdu4e00u53f7:/etc# cd apt
root@jdu4e00u53f7:/etc/apt# cat sources.list
deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
root@jdu4e00u53f7:/etc/apt#

我的apt版本是

root@jdu4e00u53f7:~/web21# apt-get -version
apt 1.2.24 (amd64)
Supported modules:
 Ver: Standard .deb
 Pkg:  Debian dpkg interface (Priority 30)
 Pkg:  Debian APT solver interface (Priority -1000)
 S.L: 'deb' Debian binary tree
 S.L: 'deb-src' Debian source tree
 Idx: Debian Source Index
 Idx: Debian Package Index
 Idx: Debian Translation Index
 Idx: Debian dpkg status file
 Idx: Debian deb file
 Idx: Debian dsc file
 Idx: Debian control file
 Idx: EDSP scenario file
E: Command line option 'e' [from -version] is not understood in combination with the other options.
root@jdu4e00u53f7:~/web21#

这是 执行sudo apt-get install mongodb mongodb-dev mongodb-server的结果

root@jdu4e00u53f7:~/web21# sudo apt-get install mongodb mongodb-dev mongodb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mongodb-dev : Depends: libboost-dev but it is not going to be installed
 mongodb-server : Depends: mongodb-clients but it is not going to be installed
                  Depends: libboost-filesystem1.54.0 but it is not going to be installed
                  Depends: libboost-program-options1.54.0 but it is not going to be installed
                  Depends: libboost-system1.54.0 but it is not going to be installed
                  Depends: libboost-thread1.54.0 but it is not going to be installed
                  Depends: libgoogle-perftools4 but it is not going to be installed
                  Depends: libpcrecpp0 (>= 7.7) but it is not going to be installed
                  Depends: libsnappy1 but it is not going to be installed
                  Depends: libstdc++6 (>= 4.6) but it is not going to be installed
                  Depends: libv8-3.14.5 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
阅读 6.4k
2 个回答

sudo apt-get install mongodb mongodb-dev mongodb-server

可能是源没有更新导致。
可以试试:

apt-get install aptitude
然后
aptitude update
最后
aptitude install mongodb-server

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进