centos8安装mongodb5

1:下载

服务端:https://repo.mongodb.org/yum/redhat/8/mongodb-org/5.0/x86_64/RPMS/mongodb-org-server-5.0.2-1.el8.x86_64.rpm

Shell工具:https://repo.mongodb.org/yum/redhat/8/mongodb-org/5.0/x86_64/RPMS/mongodb-org-shell-5.0.2-1.el8.x86_64.rpm

数据导入导出工具:https://repo.mongodb.org/yum/redhat/8/mongodb-org/5.0/x86_64/RPMS/mongodb-org-tools-5.0.2-1.el8.x86_64.rpm

集群包:https://repo.mongodb.org/yum/redhat/8/mongodb-org/5.0/x86_64/RPMS/mongodb-org-mongos-5.0.2-1.el8.x86_64.rpm

2:安装

[root@iZwz94zhiwnwqzf7b66yxqZ middle]# rpm -ivh mongodb-org-server-5.0.2-1.el8.x86_64.rpm 
warning: mongodb-org-server-5.0.2-1.el8.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID e2c63c11: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:mongodb-org-server-5.0.2-1.el8   ################################# [100%]
Created symlink /etc/systemd/system/multi-user.target.wants/mongod.service → /usr/lib/systemd/system/mongod.service.
[root@iZwz94zhiwnwqzf7b66yxqZ middle]# 

3:启动

[root@iZwz94zhiwnwqzf7b66yxqZ ~]# systemctl start mongod
[root@iZwz94zhiwnwqzf7b66yxqZ ~]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      59105/mongod        

4:安装运行shell

[root@iZwz94zhiwnwqzf7b66yxqZ middle]# rpm -ivh mongodb-org-shell-5.0.2-1.el8.x86_64.rpm 
warning: mongodb-org-shell-5.0.2-1.el8.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID e2c63c11: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:mongodb-org-shell-5.0.2-1.el8    ################################# [100%]
[root@iZwz94zhiwnwqzf7b66yxqZ middle]# mongo
MongoDB shell version v5.0.2
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("d6820ffd-0e64-4325-b08e-444cb108e251") }
MongoDB server version: 5.0.2
================
Warning: the "mongo" shell has been superseded by "mongosh",
which delivers improved usability and compatibility.The "mongo" shell has been deprecated and will be removed in
an upcoming release.
We recommend you begin using "mongosh".
For installation instructions, see
https://docs.mongodb.com/mongodb-shell/install/
================
Welcome to the MongoDB shell.

> show dbs;
admin   0.000GB
config  0.000GB
local   0.000GB

5:配置文件

默认安装的mongodb绑定的ip是127.0.0.1,需要修改

[root@1z94zhiwnwqzf7b66yxqZ etc]# vi /etc/mongod.conf

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# Where and how to store data.
storage:
  dbPath: /var/lib/mongo
  journal:
    enabled: true
#  engine:
#  wiredTiger:

# how the process runs
processManagement:
  fork: true  # fork and run in background
  pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile
  timeZoneInfo: /usr/share/zoneinfo

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1  # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.


#security:

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options

#auditLog:

#snmp:

修改

net:
  port: 27017
  bindIp: 0.0.0.0 
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值