MongoDB 安装与配置

毕业设计采用 Python 写电影个性化推荐,于是切换到Linux,安装了Ubuntu 16.04。

数据储存选用MongoDB,记一下安装配置。

很多时候不必要找教程,官方指南能给予很好的指引。

安装

基于ubuntu 16.04 & MongoDB 3.4

MongoDB官方网站 文档页面找到 Install MongoDB Community Edition on Ubuntu,按照其安装方法进行安装(懒得翻译了…):

  1. Import the public key used by the package management system.
    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6

  2. Create a list file for MongoDB.(16.04)
    echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

  3. Reload local package database.
    sudo apt-get update

  4. Install the MongoDB packages.
    sudo apt-get install -y mongodb-org

  5. run and stop.
    sudo service mongod start
    sudo service mongod stop

  6. Verify that MongoDB has started successfully
    Verify that the mongod process has started successfully by checking the contents of the log file at **/var/log/mongodb/mongod.log ** for a line reading
    [initandlisten] waiting for connections on port <port>
    where <port> is the port configured in /etc/mongod.conf, 27017 by default.

配置

待补充 现在暂时使用默认端口27017 无账号密码

    原文作者:Leoshi
    原文地址: https://www.jianshu.com/p/8dfba64cf8b8
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞