Skip to content

Instantly share code, notes, and snippets.

@ross-u
Forked from diurivj/MongoDB_Installation.md
Created November 10, 2019 17:16
Show Gist options
  • Save ross-u/123640f5aa440edee7bae224d08f4c79 to your computer and use it in GitHub Desktop.
Save ross-u/123640f5aa440edee7bae224d08f4c79 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