[NoSQL] install MongDb and nosqlmongdb in Linux
1. Go to the official website.
2. decompress the MongoDb package and rename it to mongodb:
tar -zxvf mongodb-linux-x86_64-2.6.8.gzmv mongodb-linux-x86_64-2.6.8.gz mongodb
3. Create a folder for storing database content data and a folder for storing log content, and create a mongodb. log file in the log Folder:
mkdir data mkdir logcd logtouch mongodb.log
4. Create the mongod. conf configuration file to start MongoDb. Common configurations include:
fork = true port = 27017quiet = truedbpath = /home/mongodb/datalogpath = /home/mongodb/log/mongodb.loglogappend = trueauth = false
If fork is set to true, the command line will not be locked. If fork is set to true, the port is specified. If quiet is set to true, the command line will not be locked. If dbpath and logpath are set to true, the storage location of the data and logs will be set (absolute ), if logappend is true, logs are appended instead of overwritten. If auth is false, no user name or password is required for logon.
5. Use mongod in the bin directory to start mongodb and specify the configuration file with-f or-config:
/home/mongodb/bin/mongod --config /home/mongodb/mongod.conf
6. use mongo in the bin directory to enter mongodb. If you can successfully access MongoDb, you can register mongodb as a service: in/etc/init. create a mongodb file in the d folder and add the following code:
#!/bin/bash##chkconfig:2345 80 90#description:mongodbstart() { /home/mongodb/bin/mongod --config /home/mongodb/mongod.conf}stop() { /home/mongodb/bin/mongod --config /home/mongodb/mongod.conf --shutdown}case "$1" in start)start;; stop)stop;; restart)stopstart;; *) echo$"Usage:$0{start|stop|restart}" exit 1esac
8. Add executable permissions:
chmod +x /etc/init.d/mongodb
9. Register as a service:
Chkconfig -- add mongodb add service chkconfig mongodb on set startup service mongodb start service