Spinning Up MongoDB on Fedora 26

Here is a script I created to quickly spin up MongoDB.


By default, MongoDB will store data in /data/db.

The script creates a /data/db directory and configures permissions to allow only the root user and group with read, write and execute (7) permissions. Others have read and execute(5).

I recommended that you tailor permissions to your requirements.

The script then downloads MongoDB (Community Server) to the/tmp directory, unzips and moves the files to a newly created /usr/local/mongodb directory.

After this, the database server is then started.

By default, MongoDB listens on port 27017.

Now open another terminal window and start the shell.

cd /usr/local/mongodb/bin


This will connect you to your database server. By default, you will be connected to an empty database called test.

Please note that mongod is what is used to run the database server. mongo is the MongoDB shell which can be used to connect to the database.