zoukankan      html  css  js  c++  java
  • Linux CentOS 7 安装mongoDB(4.0.6)

    在官网下载安装包:

    https://www.mongodb.com/download-center/community

    或者通过wget下载

    然后下载到本地,解压

    [root@xxx test]# ls
    mongodb-linux-x86_64-4.0.6.tgz
    [root@xxx test]# tar -zxvf mongodb-linux-x86_64-4.0.6.tgz 
    mongodb-linux-x86_64-4.0.6/README
    mongodb-linux-x86_64-4.0.6/THIRD-PARTY-NOTICES
    mongodb-linux-x86_64-4.0.6/MPL-2
    mongodb-linux-x86_64-4.0.6/LICENSE-Community.txt
    mongodb-linux-x86_64-4.0.6/bin/mongodump
    mongodb-linux-x86_64-4.0.6/bin/mongorestore
    mongodb-linux-x86_64-4.0.6/bin/mongoexport
    mongodb-linux-x86_64-4.0.6/bin/mongoimport
    mongodb-linux-x86_64-4.0.6/bin/mongostat
    mongodb-linux-x86_64-4.0.6/bin/mongotop
    mongodb-linux-x86_64-4.0.6/bin/bsondump
    mongodb-linux-x86_64-4.0.6/bin/mongofiles
    mongodb-linux-x86_64-4.0.6/bin/mongoreplay
    mongodb-linux-x86_64-4.0.6/bin/mongod
    mongodb-linux-x86_64-4.0.6/bin/mongos
    mongodb-linux-x86_64-4.0.6/bin/mongo
    mongodb-linux-x86_64-4.0.6/bin/install_compass
    [root@xxx test]# ls
    mongodb-linux-x86_64-4.0.6  mongodb-linux-x86_64-4.0.6.tgz

    将解压出的文件夹移动到/usr/local/下并且重命名为mongodb

    [root@xxx test]# mv mongodb-linux-x86_64-4.0.6 /usr/local/mongodb/
    [root@xxx test]# cd /usr/local/mongodb/
    [root@xxx mongodb]# ls
    bin  LICENSE-Community.txt  MPL-2  README  THIRD-PARTY-NOTICES

    创建文件夹data

    [root@xxx mongodb]# mkdir data

    创建文件logs

    [root@uJZPqK149888 mongodb]# touch logs

    进入/usr/local/mongodb/bin目录下,启动mongodb服务

    [root@xxx mongodb]# cd bin
    [root@xxx bin]# ls
    bsondump  install_compass  mongo  mongod  mongodump  mongoexport  mongofiles  mongoimport  mongoreplay  mongorestore  mongos  mongostat  mongotop
    [root@xxx bin]# ./mongod --dbpath=/usr/local/mongodb/data --logpath=/usr/local/mongodb/logs --logappend  --port=27017 --fork
    about to fork child process, waiting until server is ready for connections.
    forked process: 80758
    child process started successfully, parent exiting

    进入/usr/local/mongodb/bin目录下,启动客户端

    ./mongo

    环境变量配置

    vi /etc/profile 

    export MONGODB_HOME=/usr/local/mongodb
    export PATH=$PATH:$MONGODB_HOME/bin

    保存后,重启系统配置

    source /etc/profile

    这样就不用到文件夹中启动mongo了。

    参考:

    https://blog.csdn.net/caofeiliju/article/details/80195036

    https://blog.csdn.net/rzrenyu/article/details/79472508

  • 相关阅读:
    端口扫描器的几种代码实现方案
    滴滴推理引擎IFX:千万规模设备下AI部署实践
    报名啦!第四届滴滴-IEEE未来精英论坛今夏来袭
    torch单机多卡重点:
    常见异常总结,入职阿里巴巴大概率面试题!!!
    龙小树 | R语言学习参考用书推荐
    英文写作常用网址
    LaTeX常用链接与资料
    LaTeX:算法模板
    崩溃中!我终于看明白了,什么是财富自由的底层逻辑!思维导图+笔记精华
  • 原文地址:https://www.cnblogs.com/sea-stream/p/10369334.html
Copyright © 2011-2022 走看看