我遵循了official mongodb documentation的说明,但它不起作用。我的系统找不到软件包。
由于以下错误,它仍然不起作用:
[js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused
但是至少由于this link而已安装。这是如何进行:
$ sudo cat > /etc/yum.repos.d/mongodb.repo <<EOF
[mongodb-upstream]
name=MongoDB Upstream Repository
baseurl=https://repo.mongodb.org/yum/redhat/8Server/mongodb-org/4.2/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc
EOF
$ sudo dnf install mongodb-org
编辑:我忘记了最后一步(在使用“ mongo”之前启动守护程序),现在可以使用:
sudo systemctl start mongod