Skip to content

Instantly share code, notes, and snippets.

@diurivj
Last active November 10, 2019 17:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save diurivj/f0b760b4b2f22b0ce15dc2516aea58e6 to your computer and use it in GitHub Desktop.
Save diurivj/f0b760b4b2f22b0ce15dc2516aea58e6 to your computer and use it in GitHub Desktop.
This is the MongoDB's recommended way to install MongoDB Enterprise Server.

MongoDB Installation

1. Download the files from MongoDB's page:

MongoDB recommends to use the most complete version of MongoDB Server, in order to do this, we will download MongoDB Enterprise. Download the package for your SO in TGZ format.

2. Extract the files:

$ tar -xvzf [name-of-the-file.tgz]

3. Copy all the bin files to the root of your computer:

$ cd [name-of-the-folder]/bin
$ sudo bash
$ cp * /usr/local/bin
$ exit

IF YOU HAVE INSTALLED CATALINA OS, skip step 4, and follow with the next steps.

With macOS Catalina, you can no longer store files or data in the read-only system volume, nor can you write to the "root" directory ( / ) from the command line, such as with Terminal. Read more...

4. Create the folder for the database:

$ sudo bash
$ mkdir -p /data/db
$ chmod 777 /data
$ chmod 777 /data/db
$ exit

5. Create the folder for the database:

$ sudo bash
$ mkdir -p ~/data/db
$ chmod 777 ~/data
$ chmod 777 ~/data/db
$ exit

6. Create a MongoDB configuration file:

$ touch /usr/local/etc/mongod.conf

6. Modify the DB path:

Write this on the same mongod.conf file

storage:
  dbPath: /Users/youruser/data/db

7. Create an alias to overwrite the standard DB path, and change the daemon 👹

We need to modify our .zshrc file, adding:

alias mongod='mongod -f /usr/local/etc/mongod.conf'

By Diego Vázquez :octocat:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment