简体   繁体   English

在Raspberry Pi上安装MongoDB--bash:mongo:找不到命令

[英]Installing MongoDB on a Raspberry Pi - -bash: mongo: command not found

I'm using a tutorial to install MongoDB on the raspberry pi: http://notejs.com/?p=252 我正在使用一个教程在树莓派上安装MongoDB: http : //notejs.com/? p= 252

I have followed the instructions with complete success up till the line: 我完全按照指示完成了以下工作:

Connect to an instance: 连接到实例:

mongo

I then get an error like this: 然后我得到这样的错误:

-bash: mongo: command not found -bash:mongo:找不到命令

I have followed this tutorial step by step, the only difference is that I downloaded, compiled and installed MongoDB in a folder that isn't the home folder, could this be the problem? 我已逐步按照本教程进行操作,唯一的区别是我在不是主文件夹的文件夹中下载,编译并安装了MongoDB,这可能是问题所在吗?

edit: MongoDB is apparently running already when I enter the command: sudo /etc/init.d/mongod start 编辑:当我输入命令时,MongoDB显然已经在运行: sudo /etc/init.d/mongod start

So it's not the case that it's too much for my PI 因此,对于我的PI而言,情况并非如此

The instructions have this section for making the mongod binary part of your path, which is why that is working: 说明中有此部分,用于使mongod二进制文件成为路径的一部分,这就是为什么这样起作用的原因:

sudo ln -s /opt/mongo/bin/mongod /usr/bin/mongod

But they do not do the same for the mongo shell binary. 但是对于mongo shell二进制文件,它们的功能不同。 Hence you just need to do the same thing for the that binary, that is: 因此,您只需要对该二进制文件执行相同的操作,即:

sudo ln -s /opt/mongo/bin/mongo /usr/bin/mongo

Alternatively you could add /opt/mongo/bin to your $PATH variable, or just call /opt/mongo/bin/mongo directly. 或者,您可以将/opt/mongo/bin添加到$ PATH变量中,或者直接调用/opt/mongo/bin/mongo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM