Install the MongoDB 2.6.0 binary distribution tutorial on CentOS 6.5 x64 system

  • 2020-05-13 03:45:04
  • OfStack

Access to MongoDB's foreign image is so slow that the choice of an online installation on MongoDB's website is unreliable. So, we can choose to install the 2-bin cloth package of MongoDB 2.6.

Let's install the latest MongoDB 2.6.02 base distribution on CentOS 6.5 x64.

1. Download the MongoDB 2.6.02 base distribution


$ curl -O http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.0.tgz

2. Unpack the MongoDB compression package

$ tar zvxf mongodb-linux-x86_64-2.6.0.tgz

Simplify directory names

$ mv mongodb-linux-x86_64-2.6.0 mongodb

4. Configure the PATH environment variable

Make sure that the bin directory for MongoDB is included in the PATH environment variable.
Or the primary symbol connects to the /usr/local/bin directory.


$ sudo vi /etc/profile

Add the following:

export PATH=$PATH:/home/chuser/mongodb/bin

Make environment variables work:

$ source /etc/profile

Verify whether the environment variable takes effect:

$ mongod -version
db version v2.6.0
2014-04-14T02:53:01.082+0000 git version: 1c1c76aeca21c5983dc178920f5052c298db616c

5. Run MongoDB

Create a data directory


$ mkdir -p mongodb/data/db

Make sure mongod has read and write access to the data directory.
Run MongoDB (specify the data directory to create)

$ mongod --dbpath /home/chuser/mongodb/data &

6. Verify the normal operation of MongoDB


$ mongo
MongoDB shell version: 2.6.0
connecting to: test
2014-04-14T03:40:59.560+0000 [initandlisten] connection accepted from 127.0.0.1:39014 #1 (1 connection now open)
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
> show databases;
admin  (empty)
local  0.078GB


Related articles: