How to install mongodb on Centos


1, download and extract the mongodb document. Below/opt/unzip files in (installation directory yourself store)
# wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.0.4.tgz
# tar -zxvfmongodb-linux-x86_64-2.0.4.tgz
# MV mongodb-Linux-x86_64-2.0.4.tgz mongodb2.0.4 (for convenience, named it from cleaner)
2,
Create mongodb data files stored, files (mongodb_db, and mongodb_logs)
# cd /
#mkdir mongodbdata
#cd mongodbdata
#mkdir mongodb_db
#mkdir mongodb_logs
3,
Entering just extracted mongodb2.0.4/bin directory, start mongodb, specify output path
#cd /opt/mongodb2.0.4/bin
# ./mongod –dbpath=/mongodbdata/mongodb_db –logpath=/mongodbdata/mongodb_logs/mongodb.log –logappend&
Performed will be all output going to:/mongodbdata/mongodb_logs/mongodb.log
4,
Check whether the port starts, port: 27017
# netstat -lanp | grep 27017
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 560/mongod unix 2 [ ACC ] STREAM LISTENING 128435 560/mongod /tmp/mongodb-27017.sock
Started successfully
5,
5th: you can use the mongodb client, connect to the database. Into the bin directory, the implementation of Mongo
# ./mongo
MongoDB shell version: 2.0.4connecting to: test
>Use mongo_test Creating library
>Db.createCollection (test) create table