Test Environment Version CentOS 6.5
First create the installation destination folder and go to the folder:
mkdir /opt//opt/mongodb
Create users and user groups for MongoDB:
-G MongoDB MongoDB
Download the required source files for installation:
This download is slow, I am collecting MongoDB 2.6.1 version
Can be downloaded from here: http://pan.baidu.com/s/1nfAA6
or download from mongodb.org (very slow)
Http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.1.tgz
Unpack
Tar mongodb-linux-x86_64-2.6.1.tgz
To create a MongoDB data store folder:
mkdir -p/data/dbchown mongodb/data/db
Set Environment variables:
VI ~/
Append content: Export PATH=.: $PATH:/opt/mongodb/mongodb-linux-x86_64-2.6.1/bin
Make the setting effective immediately:
Now that the installation is complete, start MongoDB:
Mongod--dbpath/data/db &
To stop MongoDB:
Killall Mongod
Add MongoDB to the startup item:
Echo " mongod--dbpath/data/db & " >>/etc/rc.local
To perform a link:
Mongo
Displays the following information to indicate that the installation was successful:
MongoDB Shell version:2.6.1
Connecting To:test
The specific use of MongoDB can be referred to W3cschool's tutorial: http://www.w3cschool.cc/mongodb/mongodb-tutorial.html