First, installation
① Add the MONGO installation configuration to Yum
Vi/etc/yum.repos.d/mongodb-org-3.4.repo
Copy the following configuration to a file
[mongodb-org-3.4]
Name=mongodb Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.4/x86_64/
Gpgcheck=1
enabled=1
GPGKEY=HTTPS://WWW.MONGODB.ORG/STATIC/PGP/SERVER-3.4.ASC
② running the install command
sudo yum install-y mongodb-org
The following log appears to indicate that the installation was successful.
③ Setting the data storage path
By default, the MONGO storage path is/data/db, and if this file is not present in the system, it will not start successfully. So to manually wear this folder
Mkdir-p/data/db ④ start MONGO
sudo service Mongod start
The following log appears to indicate the success of the startup.
⑤ connecting the local MONGO
Mongo
At this time the installation of MONGO has been completed, the above log warning what can be resolved through the configuration, but does not affect the use.
Reference: https://docs.mongodb.com/master/mongo/ Two, MONGO remote connection
Note: MONGO remote connection requires permission control to be turned on
This tutorial is not too much about permissions issues, permission details can be consulted:
http://www.cnblogs.com/hanyinglong/archive/2016/07/25/5704320.html ① Adding a new user
First add an administrator account (root):
Db.createuser ({
User: "Root",
pwd: "Password",
roles:[{role: "Root", DB: "Admin"}]
})
Add a regular account (read and write access):
(The DB in the command represents the database assigned by the user)
Db.createuser ({
User: "Zhanghao",
pwd: "Mima",
roles:[{role: "ReadWrite", DB: "Test"}]
});
② Modifying a configuration file
Vi/etc/mongod.conf
Commented out:
bindip:127.0.0.1 # Listen to local interface only, comment to Listen on all interfaces.
Added:
Security:
authorization:enabled
③ Restart MONGO remote connection
Service Mongod Restart
Open Robo (MONGO Visualizer):
Finally click on save to be happy to use.