这篇基本就是为自己的安装流程做个记录,避免有些信息回头要用的时候忘了
Install MongoDB Community Edition
MongoDB only provides packages for 64-bit LTS (long-term support) Ubuntu releases. For example, 12.04 LTS (precise), 14.04 LTS (trusty), 16.04 LTS (xenial), and so on. 这里我们用的是14.04 LTS (trusty)
- Import the public key used by the package management system.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
- Create a list file for MongoDB.
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
- Reload local package database.
sudo apt-get update
- Install the MongoDB packages.
sudo apt-get install -y mongodb-org
Run MongoDB Community Edition
The MongoDB instance stores its data files in /var/lib/mongodb
and its log files in /var/log/mongodb
by default, and runs using the mongodb
user account. You can specify alternate log and data file directories in /etc/mongod.conf.
sudo service mongod start
sudo service mongod stop
sudo service mongod restart
检查版本
mongo --version
路径信息和默认参数说明:
Sources: /usr/bin/
Logs: /var/log/mongodb/mongod.log
Data: /var/lib/mongodb/
Default ip: 127.0.0.1
Default port MongoDB is listening: 27017
以上信息都可以通过编辑/etc/mongod.conf
进行修改.
网友评论