Ubuntu下mongodb安装
发布日期:2021-07-01 02:41:57 浏览次数:2 分类:技术文章

本文共 907 字,大约阅读时间需要 3 分钟。

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

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

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

    mkdir datatouch mongodb.logtouch mongodb.conf
  4. 配置文件内容:

    dbpath=/usr/local/mongodb/datalogpath=/usr/local/mongodb/mongodb.loglogappend=truejournal=truefork=truebind_ip = 127.0.0.1port = 27017noauth = true#auth = true
  5. 将mongo添加path:

    #打开profilevi /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: 1361child process started successfully, parent exiting

转载地址:https://melodyjerry.blog.csdn.net/article/details/108750202 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Vim提示No write since last change (add ! to override)
下一篇:使用Hexo+GitHub建站

发表评论

最新留言

关注你微信了!
[***.104.42.241]2024年04月24日 09时51分56秒