第三步:安装mongodb3.0
添加key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
添加deb源
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
备注:其中lsb_release 是一个查看系统发行版本的命令 -sc 是指查看codeName
可以在系统上运行lsb_release -sc 如果为utopic,则需将”$(lsb_release -sc)” 替换成trusty 因为目前http://repo.mongodb.org/apt/ubuntu 中没有utopic,可以访问http://repo.mongodb.org/apt/ubuntu查看就知道了
执行安装
sudo apt-get update
sudo apt-get install -y mongodb-org
基本使用命令及参数
- 启动
方式一:sudo service mongod start
方式二:
mongod --config /etc/mongod.conf --dbpath youdbpath --port 27017 --storageEngine wiredTiger
具体启动的参数详细见http://docs.mongodb.org/manual/reference/program/mongod/
- 配置文件及参数
配置文件在 /etc/mongod.conf
具体参数详见:
http://docs.mongodb.org/manual/reference/configuration-options/