wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.0.3.tgz
2. Unzip:
tar -zxvf mongodb-linux-i686-2.0.3.tgz
3. Specify the installation directory:
mv mongodb-linux-i686-2.0.3.tgz /usr/local/mongodb
4. Create a new mongodb data file storage directory:
mkdir -p /data0/mongodn/db
5. Create a new log file storage directory:
mkdir -p /data0/mongodn/logs
6。
cd /usr/local/mongodb/bin
7. Create a new configuration file. mongodb supports writing parameters into the configuration file, and then starts with the configuration of the configuration file. We also use this method here. implement:
vi mongodb.conf
Add the following content:
dbpath = /data0/mongodb/db #Data file storage directory logpath = /data0/mongodb/logs/mongodb.log #log file storage directory port = 27017 #Port fork = true #Enable as a daemon, that is, run in the background nohttpinterface = true
Re-bind mongodb's configuration file address and access IP:
/usr/local/mongodb/bin/mongod --bind_ip localhost -f /usr/local/mongodb/bin/mongodb.conf
8. Start the Mongo program and use the parameters defined in the configuration file mongodb.conf to start
./mongod --config mongodb.conf
9. Test, OK, the installation is successful!
For mongodb installation, refer to http://gevin.me/289.html
to automatically start mongodb
and execute:
vi /etc/rc.d/rc.local
Add to the file:
/usr/local/mongodb/bin/mongod --config /usr/local/mongodb/bin/mongodb.conf
Note: The default mongodb data directory corresponds to /data/db. Log directory For the path to /data/logs/mongodb.log, if the directory structure is adjusted, the configuration path needs to be re-specified