June 8, 2020 / Eternal Team
What is MongoDB?
As per Wikipedia “MongoDB is a cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas. MongoDB is developed by MongoDB Inc. and licensed under the Server Side Public License (SSPL)”.
Step 1
$ wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
The operation should respond with an OK.
$ sudo apt-get install gnupg
$ wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
Step 2
$ sudo touch /etc/apt/sources.list.d/mongodb-org-4.2
Step 3
$ echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
Step 4
$ sudo apt-get update
Step 5
$ sudo apt-get install -y mongodb-org
Step 6
$ sudo systemctl start mongod
$ sudo systemctl daemon-reload
Step 7
$ sudo systemctl status mongod
Step 8
$ sudo systemctl enable mongod
Step 9 (Optional)
$ sudo systemctl stop mongod
Step 10 (Optional)
$ sudo systemctl restart mongod
Step 11
$ sudo service mongod stop
Step 12
$ sudo apt-get purge mongodb-org*
# network interfaces net: port: 27017 bindIp: 0.0.0.0
# network interfaces net: port: 27017 bindIp: 192.168.1.100
# network interfaces net: port: 27017 bindIp: 127.0.0.1,192.168.1.100
$ sudo systemctl daemon-reload $ sudo systemctl restart mongod