MongoDB5.0 安装

1.配置YUM

配置yum文件

cat mongodb.repo 
[mongodb-org-5.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/5.0/x86_64/
gpgcheck=0
enabled=1
#gpgkey=https://pgp.mongodb.com/server-5.0.asc

[root@test yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
local                                                                                                                                                                     | 3.6 kB  00:00:00     
mongodb-org-5.0                                                                                                                                                           | 1.3 kB  00:00:00     
(1/3): mongodb-org-5.0/primary                                                                                                                                            |  61 kB  00:00:00     
(2/3): mongodb-org-5.0/other                                                                                                                                              |  21 kB  00:00:00     
(3/3): mongodb-org-5.0/filelists                                                                                                                                          |  22 kB  00:00:16     
mongodb-org-5.0                                                                                                                                                                          498/498
mongodb-org-5.0                                                                                                                                                                          498/498
mongodb-org-5.0                                                                                                                                                                          498/498
Metadata Cache Created

关闭YUM自动更新(安装完后执行)

 vi /etc/yum.conf 添加:
exclude=mongodb-org,mongodb-org-database,mongodb-org-server,mongodb-mongosh,mongodb-org-mongos,mongodb-org-tools

2.安装MongoDB 5.0

 yum install -y mongodb-org-5.0.28 mongodb-org-database-5.0.28 mongodb-org-server-5.0.28 mongodb-org-shell-5.0.28 mongodb-org-mongos-5.0.28 mongodb-org-tools-5.0.28

3.启动mongod

[root@test yum.repos.d]# systemctl start mongod
[root@test yum.repos.d]# 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 2024-08-10 00:34:09 EDT; 6s ago
     Docs: https://docs.mongodb.org/manual
 Main PID: 19542 (mongod)
   CGroup: /system.slice/mongod.service
           └─19542 /usr/bin/mongod -f /etc/mongod.conf

Aug 10 00:34:09 test systemd[1]: Started MongoDB Database Server.
Aug 10 00:34:09 test mongod[19542]: {"t":{"$date":"2024-08-10T04:34:09.372Z"},"s":"I",  "c":"CONTROL",  "id":7484500, "ctx":"-","msg":"Environment variable MONGODB_CONFIG_OVERRI...\" to false"}
Hint: Some lines were ellipsized, use -l to show in full.

4.连接mongosh

[root@test yum.repos.d]# mongosh
Current Mongosh Log ID: 66b6edff3169b05c3e838725
Connecting to:          mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+2.2.15
Using MongoDB:          5.0.28
Using Mongosh:          2.2.15

For mongosh info see: https://docs.mongodb.com/mongodb-shell/


To help improve our products, anonymous usage data is collected and sent to MongoDB periodically (https://www.mongodb.com/legal/privacy-policy).
You can opt-out by running the disableTelemetry() command.

 ------
   The server generated these startup warnings when booting
   2024-08-10T00:34:10.530-04:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
   2024-08-10T00:34:10.536-04:00: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. We suggest setting it to 'never' in this binary version
   2024-08-10T00:34:10.536-04:00: /sys/kernel/mm/transparent_hugepage/defrag is 'always'. We suggest setting it to 'never' in this binary version
------


Deprecation warnings:
  - Using mongosh on the current operating system is deprecated, and support may be removed in a future release.
See https://www.mongodb.com/docs/mongodb-shell/install/#supported-operating-systems for documentation on supported platforms.
test> show dbs
admin   40.00 KiB
config  12.00 KiB
local   40.00 KiB
test> 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

南風_入弦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值