Watch the video:
0:00 - Intro/Explanation
0:23 - Installing MongoDB
1:05 - Starting MongoDB Server
Introduction
MongoDB is a popular and powerful NoSQL database that provides scalability, flexibility, and ease of use for developers. In this guide, we will walk you through the process of installing and using MongoDB on Ubuntu/Debian Linux. Whether you are a beginner or an experienced user, this step-by-step tutorial will help you set up your own MongoDB server and connect to it from anywhere.
While this article should be up to date for the most up to date, detailed install instructions, please see the following link: https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-debian/
Installing MongoDB Community Edition
Before installing MongoDB, it is important to ensure that your Ubuntu/Debian Linux system is up to date and has the necessary dependencies. Open a terminal and run the following commands:
|
|
Installing MongoDB
Instead of going through the instructions and incredible detail, here’s the important bits to installing.
|
|
Connecting to MongoDB
You can use the mongo command locally to Connect to and use the Mongodb server. Otherwise you can use something like a MongoDB compass, which is much better and much more granular control as it’s a gui interface.
You can download MongoDB compass here.
Configuring Bind IP for Remote Connections
By default, MongoDB binds to the 127.0.0.1 IP address, which allows connections only from the local machine. If you want to connect to the MongoDB server from remote machines, you need to modify the bind IP configuration.
Open the MongoDB configuration file using a text editor:
|
|
Find the net.bindIp setting and change the value to 0.0.0.0 to allow connections from all IP addresses:
|
|
Save the file and exit the text editor.
If you’re using a firewall, that’s also a good idea to an mongo through it using the following command for UFW:
|
|
Uninstalling MongoDB
Should you ever choose to uninstall Mongodb, simply run the following commands:
|
|