简体   繁体   中英

how to install mongodb binary package on linux

I'm trying to install mongodb binary package by following the steps at http://docs.mongodb.org/manual/tutorial/install-mongodb-on-linux/ I'm on debian linux(Ubuntu 12.04) when I try to launch mongod, I get the message

bash: /usr/local/bin/mongod: cannot execute binary file

the ldd from /usr/local/bin/mongod reads not a dynamic executable

Installing mongodb binary package on linux takes only a few minutes. I would like to include installation of mongodb binary steps in shorter here:

Step 1 : Download the latest .tar.gz file from here ,always prefer 64 bit for production.

Step 2 : Make a source directory(/usr/local) and now extract the downloaded file using the below command:

 tar zxf mongodb-linux-i686-1.6.0.tar.gz 

Step 3 : Create a data directory using the below command

mkdir -p /data/db

Step 4 : Create an user mongo_user using the following command

useradd mongo_user

Step 5 : Change the ownership of the files in the source and data directory using the following command

chown -R mongo_user.mongo_user /usr/local/

chown -R mongo_user.mongo_user /data/db/

Step 6 : Create a configuration file in any directory say vim /etc/mongod.conf

Now add the following details as shown below:

verbose = true
dbpath = /data/db
logpath = /var/log/mongodb.log
logappend = true
port = 27017

Step 7 : Move to the bin folder in the source directory and now start the mongo server by the following command

./mongod --config /etc/mongod.conf

Step 8 : Within the bin folder in source directory start the mongo client by the following command

./mongo --port 27017

The mongodb prompt appears !!!

PS : This is partially adapted from my blog. For a clearer explanation see the original article .

This should get you up and running quickly:

Install (/home/username/)

sudo wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.7.tgz?_ga=1.57038442.1512045927.1417277541

sudo tar -zxvf mongodb-linux-x86_64-2.6.7.tgz?_ga=1.57038442.1512045927.1417277541

sudo mv mongodb-linux-x86_64-2.6.7 mongo-2.6.7

Create database directory (/home/username/mongo-2.6.7)

sudo mkdir databases 

Start mongo

mongod --dbpath /home/username/mongo-2.6.7/databases

Enter shell (/home/username/mongo-2.6.7/bin)

./mongo 

You can set-up more in-depth configurations after you've played with it a bit.

It is caused by running 64-bit application on 32-bit system or vice versa.

Double checkin and aligning your Linux OS version and the Mongodb version will solve this issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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