Trying to setup Mongodb on Debian
I am trying to setup the database client MongoDB and am running into some problems getting it to startup.
What I have done:
I downlo开发者_开发问答aded the 2.0 version of mongoDB from http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.0.0.tgz
I extracted it (
tar xzf
).I then ran the command
mkdir /data/db
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?
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
Just untaring an archive doesn't install it.. You have to go to the mongodb directory and run ./bin/mongod
to run the server..
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
There is a debian
package for mongodb
. so just run apt-get install mongodb
in terminal.
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.
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.
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.
精彩评论