尝试在 Debian 上设置 Mongodb

发布于 2024-12-08 05:19:42 字数 453 浏览 3 评论 0原文

我正在尝试设置数据库客户端 MongoDB,但在启动时遇到一些问题。

我所做的:

不幸的是,当我尝试运行 mongod 我得到找不到命令。我可能在这部分过程中失败的原因是什么?

I am trying to setup the database client MongoDB and am running into some problems getting it to startup.

What I have done:

Unfortunately when I try to run mongod I get command not found. Any reason why I might be failing at this part of the process?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

々眼睛长脚气 2024-12-15 05:19:42

我想你并没有在下载页面上一直向下滚动并获取那里的第一个 Linux 版本。这是帮助您从 APT 安装 mongodb 的链接,它运行得非常好。 http://www.mongodb.org/display/DOCS/Ubuntu+and +Debian+软件包

I think you did not scroll all the way down on the download page and took the first linux version that was there. Here is the link that will help you install mongodb from APT it works really well. http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages

注定孤独终老 2024-12-15 05:19:42

仅解压存档并不会安装它。您必须转到 mongodb 目录并运行 ./bin/mongod 才能运行服务器。

Just untaring an archive doesn't install it.. You have to go to the mongodb directory and run ./bin/mongod to run the server..

混吃等死 2024-12-15 05:19:42

试试这个:

# apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
# echo 'deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen' | tee /etc/apt/sources.list.d/mongodb.list
# apt-get update
# apt-get install -y mongodb-org

启动 MongoDB:

# /etc/init.d/mongod start

Try this:

# apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
# echo 'deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen' | tee /etc/apt/sources.list.d/mongodb.list
# apt-get update
# apt-get install -y mongodb-org

To start MongoDB:

# /etc/init.d/mongod start
痴意少年 2024-12-15 05:19:42

有一个用于 mongodbdebian 软件包。所以只需在终端中运行 apt-get install mongodb 即可。

There is a debian package for mongodb. so just run apt-get install mongodb in terminal.

嗫嚅 2024-12-15 05:19:42

在 Debian 上安装和配置 MongoDB 的一种简单方法是使用 APT 包,请查看官方文档 Ubuntu 和 Debian 软件包 了解分步说明。

An easy way to install and configure MongoDB on Debian is from the APT package, check out the official docs for Ubuntu and Debian packages for step-by-step instructions.

故事↓在人 2024-12-15 05:19:42

我知道我参加聚会有点晚了,因为答案已经被检查过,但我通常不喜欢做包裹路线,因为我过去因为过时的包裹而运气不好。然而,我自己解压后就遇到了这个问题,结果发现这是我最初执行 tar xzf 时的权限问题。

当我在 bin 文件夹中时,我得到了这个:

$ mongod
-sh: mongod: not found

我最后做的是这个:

sudo chown -R $USERNAME:$USERNAME /mongodb-linux-x86_64-2.0.0/bin
sudo chown -R $USERNAME:$USERNAME /data/db
cd mongodb-linux-x86_64-2.0.0
sudo bin/mongod

瞧!

Wed Oct  5 22:46:59 [initandlisten] MongoDB starting : pid=3049 port=27017  
dbpath=/data/db/ 64-bit host=MyRackspaceRandomProject
Wed Oct  5 22:46:59 [initandlisten] db version v2.0.0, pdfile version 4.5

希望这能有所帮助。

I know I'm a bit late to the party as an answer has been checked but I generally don't like doing the packages route because I've had bad luck with out of date ones in the past. However, I just hit this issue myself after unzipping and it turned out to be a permissions issue from when I initially did the tar xzf.

When in the bin folder I was getting this:

$ mongod
-sh: mongod: not found

What I wound up doing was this:

sudo chown -R $USERNAME:$USERNAME /mongodb-linux-x86_64-2.0.0/bin
sudo chown -R $USERNAME:$USERNAME /data/db
cd mongodb-linux-x86_64-2.0.0
sudo bin/mongod

and VOILA!

Wed Oct  5 22:46:59 [initandlisten] MongoDB starting : pid=3049 port=27017  
dbpath=/data/db/ 64-bit host=MyRackspaceRandomProject
Wed Oct  5 22:46:59 [initandlisten] db version v2.0.0, pdfile version 4.5

Hopefully this helps a little more.

简单气质女生网名 2024-12-15 05:19:42

如果 Mongodb 2.0 版本就足够了,那么在 Debian squeeze 上安装它的最简单方法是:(

$ sudo echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list
$ sudo apt-get update
$ sudo apt-get -t squeeze-backports install mongodb mongodb-clients mongodb-dev mongodb-server

在本例中)明确包含 mongodb 的依赖包(如上所示)非常重要,否则您可能会遇到来自 mongodb 服务器的神秘行为 - 更多信息<一href="https://stackoverflow.com/questions/15552663/odd-results-from-mongoid-using-debian-squeeze-mongodb">此处。

If version 2.0 of Mongodb is sufficient, the easiest way to install it on Debian squeeze is by:

$ sudo echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list
$ sudo apt-get update
$ sudo apt-get -t squeeze-backports install mongodb mongodb-clients mongodb-dev mongodb-server

It's important (in this case) explicitly to include mongodb's dependency packages as shown above, or you may experience mysterious behavior from the mongodb server—more information here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文