在阿里云的ubuntu主机上安装版本为2.6的MongoDB
参考官方的文档:http://docs.mongodb.org/v2.6/tutorial/install-mongodb-on-ubuntu/
安装包说明
mongodb-org
This package is a metapackage that will automatically install the four component packages listed below.
mongodb-org-server
This package contains the mongod daemon and associated configuration and init scripts.
mongodb-org-mongos
This package contains the mongos daemon.
mongodb-org-shell
This package contains the mongo shell.
mongodb-org-tools
This package contains the following MongoDB tools: mongoimport bsondump, mongodump,mongoexport, mongofiles, mongooplog, mongoperf, mongorestore, mongostat, andmongotop.
安装
1:sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
2:echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
3:sudo apt-get update
4:sudo apt-get install -y mongodb-org
如何安装指定的版本以及避免有新版本可用时升级MongoDB请参看官方的文档,有详细说明。
配置
配置文件/etc/mongod.conf
具体的配置项目http://docs.mongodb.org/v2.6/reference/configuration-options/ 有详细说明,可以仔细看看。
默认只能在127.0.0.1连接
运行
sudo service mongod start/stop/restart
可以到/var/log/mongodb/mongod.log看日志
【注】悲剧了,在阿里云的主机上,sudo apt-get install -y mongodb-org一直不成功,貌似是连不上服务器。墙了?给跪了