我是ubuntu和mongodb的新手。ubuntu安装在vm托管的Windows 8.1上。我试图在 ubuntu v18.04 bionic 上安装 mongodb v4.2.2 :
导入公钥
ubuntu@ubuntu:~$ wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
OK
安装gnupg及其必需的库
ubuntu@ubuntu:~$ sudo apt-get install gnupg
Reading package lists... Done
Building dependency tree
Reading state information... Done
gnupg is already the newest version (2.2.4-1ubuntu1.2).
The following package was automatically installed and is no longer required:
linux-modules-5.0.0-36-generic
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 55 not upgraded.
重试导入密钥
ubuntu@ubuntu:~$ wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
OK
为Ubuntu 18.04(Bionic)创建/etc/apt/sources.list.d/mongodb-org-4.2.list文件
ubuntu@ubuntu:~$ echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse
ubuntu@ubuntu:~$ sudo apt-get update
Hit:1 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:3 http://packages.microsoft.com/repos/vscode stable InRelease
Get:5 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Hit:6 https://deb.nodesource.com/node_13.x bionic InRelease
Ign:7 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 InRelease
Ign:8 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 InRelease
Hit:9 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 Release
Get:10 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Hit:11 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 Release
Get:4 http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist InRelease [121 kB]
Err:4 http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist InRelease
Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Reading package lists... Done
E: Failed to fetch http://downloads-distro.mongodb.org/repo/ubuntu-upstart/dists/dist/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
如您所见,我在此步骤上遇到一些无法修复的错误。 事实上,我不知道是什么原因造成的。
我安装了mongodb却没有错误
ubuntu@ubuntu:~$ sudo apt-get install -y mongodb-org
然后我启动了它并检查了它的状态
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2020-01-21 10:24:32 PST; 4s ago
Docs: https://docs.mongodb.org/manual
Process: 2164 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=48)
Main PID: 2164 (code=exited, status=48)
Jan 21 10:24:32 ubuntu systemd[1]: Started MongoDB Database Server.
Jan 21 10:24:32 ubuntu systemd[1]: mongod.service: Main process exited, code=exited, status=48/n/a
Jan 21 10:24:32 ubuntu systemd[1]: mongod.service: Failed with result 'exit-code'.
请帮助我解决此问题