码迷,mamicode.com
首页 > 数据库 > 详细

Ubuntu下mongodb安装

时间:2020-09-24 20:47:08      阅读:37      评论:0      收藏:0      [点我收藏+]

标签:cal   启动   nal   tps   process   mongodb   waiting   bash   配置   

  1. 下载mongodb源码,并解压:

    wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1604-4.0.11.tgz
    
    tar -zxvf mongodb-linux-x86_64-ubuntu1604-4.0.11.tgz
    
  2. 创建mongo专属目录,拷贝bin下文件到mongodb目录下bin中:

    mkdir /usr/local/mongodb
    
    cd /usr/local/mongodb
    
    mkdir bin
    
    cp .../mongodb-linux-x86_64-ubuntu1604-4.0.11/bin/* ./bin/
    
  3. 创建数据库文件目录、日志目录、配置文件:

    mkdir data
    
    touch mongodb.log
    
    touch mongodb.conf
    
  4. 配置文件内容:

    dbpath=/usr/local/mongodb/data
    logpath=/usr/local/mongodb/mongodb.log
    
    logappend=true
    journal=true
    fork=true
    
    bind_ip = 127.0.0.1
    port = 27017
    
    noauth = true
    #auth = true
    
  5. 将mongo添加path:

    #打开profile
    vi /etc/profile
    
    #输入下面内容:
    MONGO_DB="/usr/local/mongodb"
    PATH=$MONGO_DB/bin:$PATH:
    export PATH
    
    #加载配置
    source /etc/profile
    
  6. 启动mongodb:

    /usr/local/mongodb/bin/mongod --config /usr/local/mongodb/mongodb.conf
    
    #启动后会看到:
    
    about to fork child process, waiting until server is ready for connections.
    forked process: 1361
    child process started successfully, parent exiting
    

Ubuntu下mongodb安装

标签:cal   启动   nal   tps   process   mongodb   waiting   bash   配置   

原文地址:https://www.cnblogs.com/melodyjerry/p/13714400.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!