In this blog post, we will cover how to start MongoDB database software in the three most used platforms: Windows/Linux/MacOS.

If you have just started with NoSQL databases, you might wonder how to evaluate if MongoDB is a good fit for your application.

Percona provides a signed version of MongoDB called Percona Server for MongoDB with a couple of enterprise-grade features included free of charge that runs on all Linux flavors. We also support MongoDB, please check out our support page. But, what if you’re running a test on your study laptop, PC or not. How do you easily start a mongod process for testing? Below I demonstrate how to start MongoDB database software on the three most popular operating systems.

Microsoft Windows

First of all, be aware of this hotfix: https://support.microsoft.com/en-ca/help/2731284/33-dos-error-code-when-memory-memory-mapped-files-are-cleaned-by-using.

You might need to restart the computer after applying the fix. Then download the .zip file. The website only offers an MSI, but we don’t want to install the binaries, we just want to run it.

Click here to download the 3.4.10 version:
http://downloads.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-3.4.10.zip

After the download, use your favorite decompressing tool to extract the MongoDB executables. Then cut the extracted folder to your Documents or C: or even a memory stick (but don’t expect high performance):

 

Inside of the bin folder, create a data folder. We are going to use this folder to save our databases.

 

Now we have everything we need to start the database. Open the CMD, and run the following commands to start the database:

You will see an output like:

This means the process is running.

In a different CMD, connect to the database using:

I’ve passed the –quiet to omit the warnings:

And here we go, MongoDB is running on a windows machine!

MacOS and Linux configuration:

For macOS, the process is very similar to Windows. The difference is that we can take advantage of the extensive bash commands that the UNIX-like system offers.

Open the terminal. Go to our home/Downloads folder:

Download MongoDB for MacOS or Linux:

The output must be similar to:

On a different tab run:

At this point, you should be able to use MongoDB with the default options on MacOS or Linux.

Note that we aren’t enabling authentication either configuring a replica set.

If we don’t pass the –quiet parameter we will receive a few warnings like:

For more information about how to configure those parameters, please refer to the following blog post and or documentation:

https://www.percona.com/blog/2017/12/15/mongodb-3-6-security-improvements/

https://www.percona.com/blog/2017/05/17/mongodb-authentication-and-roles-creating-your-first-personalized-role/

https://www.percona.com/blog/2016/08/12/tuning-linux-for-mongodb/

To stop the mongod process, use ctrl+c (on any operating system) in the server window.