install mongodb5 on centos8

1: Download

Server: 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 tool: 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

Data import and export tools: 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

Cluster package: 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: Install

[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: start

[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: Install and run the 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: Configuration file

The default installed mongodb binding ip is 127.0.0.1, which needs to be modified

[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:

Revise

net:
  port: 27017
  bindIp: 0.0.0.0 
 

Guess you like

Origin blog.csdn.net/wind520/article/details/120168773
Recommended