ubuntu server安装mongodb

1.配置Package Management System

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

2.使用下面的命令创建mongodb的源

echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list

3.更新ubuntu的版本库

sudo apt-get update

4.安装mongodb

sudo apt-get install mongodb-10gen

5.启动mongodb

sudo service mongodb start

6.停止mongodb

sudo service mongodb stop

7.重启mongodb

sudo service mongodb restart

附:官方安装地址:http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/