Skip to content

SEIR-7-06/mongo-install

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 

Repository files navigation

MongoDB

MonogDB is a database that stores information as easy to read "documents". We'll use it to store data in our Node.js and Express stack.

The installation instructions can be found here for all operating systems. However, we'll go through the steps for Mac users together.



  1. First check if Mongo DB is already installed on your machine by running this command.
which mongo

If you get an output that shows a file path like this

/usr/local/bin/mongo

you already have MongoDB and do not need to continue with the instructions below.

If you get an output that says mongo not found, that means you should install Mongo DB and follow the instructions below.



For Mac M1 Chip Users

Mac M1 Chip users follow these steps before continuing past this point.
  1. Check where Homebrew installs packages.
brew --prefix

You may see /usr/local. We'll update this so that homebrew installs packages in the proper location (/opt/homebrew).



  1. The following steps will create the proper directory, set up the permissions, and download Homebrew.
sudo mkdir -p /opt/homebrew
sudo chown -R $(whoami):staff /opt/homebrew
cd /opt
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew


  1. Add the Homebrew bin to your PATH variable.
echo export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" >> ~/.zprofile
echo export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" >> ~/.zshrc
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"


  1. Quit out of your terminal completely with cmd + q and then open it up again.


  1. Check if the Homebrew install location has been updated.
brew --prefix

You should now see /opt/homebrew and are good to continue.



Install MongoDB on Mac


  1. Run this command to get the updated brew tap for mongo.
brew tap mongodb/brew


  1. Install Mongo DB Community
brew install mongodb-community@5.0


  1. Start the Mongo service running in the background
brew services start mongodb-community@5.0


  1. After the installation, run the which command to verify the install was successful.
which mongo

If this has worked correctly, you should see a file path as output.

You are all set and ready to Mongo!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published