美文网首页我爱编程
在阿里云ECS上安装MongoDB

在阿里云ECS上安装MongoDB

作者: 不务正业的Yuez | 来源:发表于2016-11-08 07:41 被阅读325次

这篇基本就是为自己的安装流程做个记录,避免有些信息回头要用的时候忘了

主要参考官方文档这篇教程

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)

  1. Import the public key used by the package management system.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
  1. 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
  1. Reload local package database.
sudo apt-get update
  1. 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进行修改.

相关文章

网友评论

    本文标题:在阿里云ECS上安装MongoDB

    本文链接:https://www.haomeiwen.com/subject/pklauttx.html