我之前在无法在 ubuntu 14.04 上安装 mongodb但这个问题并没有让我从 mongodb 存储库安装。我想我可以编辑这个问题,但这会使给出的答案无效,而且由于这不再是一个新问题,所以很可能不会被注意到。
无论如何,我正在尝试在 Ubuntu 15.04 上安装 MongoDB,但无法安装。我做了以下操作:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo apt-get update
返回以下内容:
Ign http://repo.mongodb.org vivid/mongodb-org/3.0 InRelease
Ign http://archive.ubuntu.com vivid InRelease
Ign http://security.ubuntu.com vivid-security InRelease
Ign http://repo.mongodb.org vivid/mongodb-org/3.0 Release.gpg
Ign http://archive.ubuntu.com vivid-updates InRelease
Get:1 http://security.ubuntu.com vivid-security Release.gpg [933 B]
Get:2 http://archive.ubuntu.com vivid Release.gpg [933 B]
Get:3 http://security.ubuntu.com vivid-security Release [63.5 kB]
Ign http://repo.mongodb.org vivid/mongodb-org/3.0 Release
Get:4 http://archive.ubuntu.com vivid-updates Release.gpg [933 B]
Get:5 http://archive.ubuntu.com vivid Release [217 kB]
Get:6 http://security.ubuntu.com vivid-security/main amd64 Packages [99.8 kB]
Get:7 http://security.ubuntu.com vivid-security/restricted amd64 Packages [28 B]
Get:8 http://security.ubuntu.com vivid-security/main Translation-en [52.7 kB]
Get:9 http://archive.ubuntu.com vivid-updates Release [63.5 kB]
Get:10 http://security.ubuntu.com vivid-security/restricted Translation-en [14 B]
Get:11 http://archive.ubuntu.com vivid/main amd64 Packages [1,364 kB]
Err http://repo.mongodb.org vivid/mongodb-org/3.0/multiverse amd64 Packages
404 Not Found
Ign http://repo.mongodb.org vivid/mongodb-org/3.0/multiverse Translation-en_US
Ign http://repo.mongodb.org vivid/mongodb-org/3.0/multiverse Translation-en
Get:12 http://archive.ubuntu.com vivid/restricted amd64 Packages [15.4 kB]
Get:13 http://archive.ubuntu.com vivid/main Translation-en [793 kB]
Hit http://archive.ubuntu.com vivid/restricted Translation-en
Get:14 http://archive.ubuntu.com vivid-updates/main amd64 Packages [171 kB]
Get:15 http://archive.ubuntu.com vivid-updates/restricted amd64 Packages [28 B]
Get:16 http://archive.ubuntu.com vivid-updates/main Translation-en [83.3 kB]
Get:17 http://archive.ubuntu.com vivid-updates/restricted Translation-en [14 B]
Fetched 2,926 kB in 4s (713 kB/s)
W: Failed to fetch http://repo.mongodb.org/apt/ubuntu/dists/vivid/mongodb-org/3.0/multiverse/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
注意 404 Not Found 错误。
无论如何,我sudo apt-get install -y mongodb-org
随后尝试并得到的输出如下:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mongodb-org
有任何想法吗?
答案1
在 15.04 上,由于 systemd,您必须安装 debian wheezy 版本。运行以下命令:
sudo rm /etc/init.d/mongod*
sudo rm /etc/apt/sources.list.d/mongo*
sudo apt-get purge mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools syslog-ng-mod-mongodb
echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get clean
sudo apt-get update
sudo apt-get install mongodb-org
sudo service mongod start
systemctl status mongod
忽略前三个命令中的任何“未找到”或“无法找到”错误。