Recently work has finally come to use MongoDB, has never previously contacted MongoDB, only know it belongs to the NoSQL type of database, here will install the record as follows:
1, to the official website to download the installation files:
This download version is: mongodb-linux-x86_64-2.6.6.gz
[email protected] tools]# ll mongodb-linux-x86_64-2.6.6.gz
-rw-r--r--1 root root 116039527 Dec mongodb-linux-x86_64-2.6.6.gz
[Email protected] tools]# Tar XF mongodb-linux-x86_64-2.6.6.gz
[email protected] tools]# ll mongodb-linux-x86_64-2.6.6*
-rw-r--r--1 root root 116039527 Dec mongodb-linux-x86_64-2.6.6.gz
mongodb-linux-x86_64-2.6.6:
Total 64
Drwxr-xr-x 2 root root 4096 Jul 02:48 bin
-rw-r--r--1 1046 1046 34520 Dec 8 gnu-agpl-3.0
-rw-r--r--1 1046 1046 1359 Dec 8 README
-rw-r--r--1 1046 1046 17793 Dec 8 third-party-notices
[Email protected] tools]#
[Email protected] tools]# MV Mongodb-linux-x86_64-2.6.6/usr/local/mongodb
[Email protected] tools]# cd/usr/local/mongodb/
[Email protected] mongodb]# pwd
/usr/local/mongodb
[Email protected] mongodb]#
2. Define the configuration file:
[Email protected] mongodb]# mkdir conf
[Email protected] mongodb]# CD conf
[Email protected] conf]# vim mongodb.conf
Port = 30000
BIND_IP = 192.168.19.25
DBPath =/data/mongo/data/db
LogPath =/data/mongo/data/log/log
Logappend = True
Fork = True
Pidfilepath =/data/mongo/data/mongod.pid
[Email protected] conf]#
[Email protected] conf]# mkdir-p/data/mongo/data/
[Email protected] conf]# mkdir-p/data/mongo/data/log
[Email protected] conf]# mkdir-p/data/mongo/data/db
Configuration file Explanation:
#port = 30000 Listening port
#bind_ip = 192.168.19.25 on which IP address to start
#dbpath =/data/mongo/data/db Define the database file path
#logpath =/data/mongo/data/log/log defines the log storage path
#logappend = True to define how the log is stored
#fork = True to define how the MongoDB process starts, which is started as a daemon
#pidfilepath =/data/mongo/data/mongod.pi define process PID file storage path
3. Add Environment variables:
[Email protected] mongodb]# CD bin/
[Email protected] bin]# pwd
/usr/local/mongodb/bin
[Email protected] bin]# Vim/etc/profile
Export Path=/usr/local/mongodb/bin: $PATH
[Email protected] bin]# Source/etc/profile
[Email protected] bin]#
4. Start MongoDB
[Email protected] bin]# mongod-f/usr/local/mongodb/conf/mongodb.conf
About-to-fork child process, waiting until server was ready for connections.
Forked process:1735
Child process started successfully, parent exiting
[Email protected] bin]#
[Email protected] bin]# netstat-lnput|grep MONGO
TCP 0 0 192.168.19.25:30000 0.0.0.0:* LISTEN 1735/mongod
[Email protected] bin]#
[Email protected] ~]# MONGO--host 192.168.19.25--port 30000
MongoDB Shell version:2.6.6
Connecting To:192.168.19.25:30000/test
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
>
The above interface indicates that MONGO installation is successful, MONGO installation is complete, as for some common commands can be viewed in/usr/local/mongo/bin directory,
[Email protected] ~]# cd/usr/local/mongodb/bin/
[email protected] bin]# LL
Total 283568
-rwxr-xr-x 1 1046 1046 23603184 Dec 8 bsondump
-rwxr-xr-x 1 1046 1046 11900240 DEC 8 MONGO
-rwxr-xr-x 1 1046 1046 23773296 Dec 8 Mongod
-rwxr-xr-x 1 1046 1046 23676016 Dec 8 mongodump
-rwxr-xr-x 1 1046 1046 23619312 Dec 8 Mongoexport
-rwxr-xr-x 1 1046 1046 23667776 Dec 8 mongofiles
-rwxr-xr-x 1 1046 1046 23644016 Dec 8 Mongoimport
-rwxr-xr-x 1 1046 1046 23614480 Dec 8 Mongooplog
-rwxr-xr-x 1 1046 1046 23424896 Dec 8 Mongoperf
-rwxr-xr-x 1 1046 1046 23713104 Dec 8 Mongorestore
-rwxr-xr-x 1 1046 1046 18433232 Dec 8 MONGOs
-rwxr-xr-x 1 1046 1046 23663984 Dec 8 Mongostat
-rwxr-xr-x 1 1046 1046 23607088 Dec 8 mongotop
[Email protected] bin]#
This article from "Flat Light is true" blog, please be sure to keep this source http://ucode.blog.51cto.com/10837891/1828805
MongoDB Installation