MongoDB的简单安装

网上的安装流程有点乱,很多都是定制化的流程。自己是小白,那么些配置不太懂。因此写了这一篇。

参考来源

我的系统是centos7.8 mini版,参考的这里
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/

网上很多步骤都没有官网的详细,英语无障碍的话还是读原文档的好。

操作流程

我采用的流程如下:
1,配置yum文件
Configure the package management system (yum).
Create a /etc/yum.repos.d/mongodb-org-4.4.repo file so that you can install MongoDB directly using yum:

[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc

You can also download the .rpm files directly from the MongoDB repository. Downloads are organized by Red Hat / CentOS version (e.g. 7), then MongoDB release version (e.g. 4.4), then architecture (e.g. x86_64). Odd-numbered MongoDB release versions, such as 4.3, are development versions and are unsuitable for production deployment.
2,安装
sudo yum install -y mongodb-org
3,启动
这里有两种启动方式,我选择了其中一种
sudo systemctl start mongod
验证是否启动
sudo systemctl status mongod

这里原文档中详细介绍了可能会遇到的问题。(我没遇到,貌似因为我的系统是干净的)

停止服务
sudo systemctl stop mongod

4,开始使用
mongo

这里没写配置。默认端口是27017
配置文件如下
vi /etc/mongod.conf

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值