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 
 

猜你喜欢

转载自blog.csdn.net/wind520/article/details/120168773
今日推荐