I. installation and configuration
1. Installation
Download: wget-c http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.0.6.tgz
Unzip: tar zxvf mongodb-linux-x86_64-2.0.6.tgz
Establish a soft connection: ln-s mongodb-linux-x86_64-2.0.6 mongodb
Create a data storage directory in mongodb. The log storage directory is mkdir-p data/db mkdir data/log.
2. Run
2.1. Start in command line mode:
./Mongod -- dbpath = ../data/db -- logpath = ../data/log/mongod. log -- fork
Explanation: mongod is the log storage directory specified by the server program dbpath -- logpath specifies the log storage directory -- fork specifies to start as a daemon (note, you must specify the log storage path when starting a daemon)
2.2 configure file startup:
Edit vim/etc/mongod. conf to add the following content:
Start:./mongod-f/etc/mongod. conf
2.3 random startup as a system service
Edit vim/etc/init. d/mongod to add the following content:
Run chkconfig -- add mongod and chkconfig -- level 35 mongod on
Restart to view