Fedora 上安装 MongoDB具体步骤

MongoDB是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的,本篇文章重点为大家介绍一下在 Fedora 上安装 MongoDB具体步骤。

1、使用上游 RPM 创建仓库(RHEL-8 构建)

$ sudo cat > /etc/yum.repos.d/mongodb.repo >>EOF  [mongodb-upstream]  name=MongoDB Upstream Repository  baseurl=https://repo.mongodb.org/yum/redhat/8Server/mongodb-org/4.2/x86_64/  gpgcheck=1  enabled=1  gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc  EOF  

2、安装元软件包,来拉取服务器和工具包

$ sudo dnf install mongodb-org  ......  Installed:   mongodb-org-4.2.3-1.el8.x86_64           mongodb-org-mongos-4.2.3-1.el8.x86_64   mongodb-org-server-4.2.3-1.el8.x86_64    mongodb-org-shell-4.2.3-1.el8.x86_64   mongodb-org-tools-4.2.3-1.el8.x86_64          Complete!  

3、启动 MongoDB 守护进程

$ sudo systemctl status mongod  ● mongod.service - MongoDB Database Server    Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)    Active: active (running) since Sat 2023-02-08 12:33:45 EST; 2s ago      Docs: https://docs.mongodb.org/manual   Process: 15768 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)   Process: 15769 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)   Process: 15770 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)   Process: 15771 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS)  Main PID: 15773 (mongod)    Memory: 70.4M       CPU: 611ms    CGroup: /system.slice/mongod.service  

4、通过 mongo shell 连接服务器来验证是否运行

$ mongo  MongoDB shell version v4.2.3  connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb  Implicit session: session { "id" : UUID("20b6e61f-c7cc-4e9b-a25e-5e306d60482f") }  MongoDB server version: 4.2.3  Welcome to the MongoDB shell.  For interactive helptype "help".  For more comprehensive documentation, see     http://docs.mongodb.org/  ---  

就是这样了。如你所见,RHEL-8 包完美兼容,只要 Fedora 包还与 RHEL-8 兼容,它就应该会一直兼容。请注意,在使用时必须遵守 SSPLv1 许可证。

本文来源:www.lxlinux.net/4727.html,若引用不当,请联系修改。


评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注