博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
centos7安装mongodb3.4
阅读量:115 次
发布时间:2019-02-26

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

本文介绍通过yum安装mongodb

1、构建mongodb源

[root@server init.d]# cd /etc/yum.repos.d/[root@server yum.repos.d]# vi mongodb.repo [MongoDb]name=mongo repobaseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/gpgcheck=0enabled=1

这里写图片描述

2、安装mongodb

yum install mongodb-org

这里写图片描述

验证版本:

这里写图片描述

3、启动

systemctl start mongod.service

这里写图片描述

4、测试

> show dbs;admin  0.000GBlocal  0.000GB> use lenovodbswitched to db lenovodb> db.user.save({name:'feiy',mobile:'15011186301'})WriteResult({ "nInserted" : 1 })> db.user.find(){ "_id" : ObjectId("5881c3d15528faa7b424d028"), "name" : "feiy", "mobile" : "15011186301" }> exit

这里写图片描述

你可能感兴趣的文章