Recently has been looking at MongoDB book, but the practice is not much, today at noon using the rest, the virtual machine was installed, operating system for cent OS 6.2 (64-bit). The following records are as follows;
1 Download the installation package to the/home/software directory
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.2.2.tgz
2 Extract the program to the current directory
Tar xzvf mongodb-linux-x86_64-2.2.2.tgz
3 Install the program into the/usr/local directory (note/usr/local/mongodb This directory must exist)
MV Mongodb-linux-x86_64-2.2.2/usr/local/mongodb
4 Creating a configuration file
Vim/etc/mongodb.conf
5 Modify the configuration file contents as follows
Logpath=/usr/local/mongodb/log/mongodb.log
logappend=true
fork=true
dbpath=/usr/local/mongodb/data
port=27017
6 Create data directory and log directory files according to the configuration file
Mkdir/usr/local/mongodb/data
mkdir/usr/local/mongodb/log
vim /usr/local/mongodb/log/mongodb.log
7 Creating a startup script
Vim/usr/local/mongodb/start_mongodb
8 Modify the contents of the startup script to read as follows:
#。 /bin/sh
/usr/local/mongodb/bin/mongod--config/etc/mongodb.conf
9 Modify the Startup script permissions:
chmod +x/usr/local/mongodb/start_mongodb
10 Starting the database
./usr/local/mongodb/start_mongodb
In this case, you will see the prompt to start success, in addition to our launch script can be placed in the/usr/bin directory, so that we can directly start MongoDB in any location, if you have any problems in the installation, I would like to solve for everyone.