MongoDB基础之一:Conetos下安装MongoDB
1.下载自己需要的版本,我这用的是mongodb-linux-x86_64-2.4.9.tgz
#cd /usr/local/src
# wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.9.tgz
# tar -xvzf mongodb-linux-x86_64-2.4.9.tgz
2.创建mongodb目录,和数据库目录。
# mv mongodb-linux-x86_64-2.4.9 /usr/local/mongodb
# mkdir /home/mdata
# mdkir /home/mlog
3.启动mongodb
# cd /usr/local/mongodb
# ./bin/mongod --dbpath /home/mdata --logpath /home/mlog/mlog.log --fork
[root@localhost mongodb]# ./bin/mongod --dbpath /home/mdata --logpath /home/mlog/mlog.log --fork
about to fork child process, waiting until server is ready for connections.
forked process: 7253
all output going to: /home/mlog/mlog.log
child process started successfully, parent exiting
4.测试一下:
到这里,我们其实已经可以使用mongodb了
[root@localhost mongodb]# ./bin/mongo
MongoDB shell version: 2.4.9
connecting to: test
>
>
>