0% found this document useful (0 votes)
39 views4 pages

MongoDB Installation

The document provides instructions for installing MongoDB on Ubuntu, MacOS, and Windows. It details the steps to import keys, create a list file, update packages, install MongoDB, start the MongoDB service, and begin using MongoDB.

Uploaded by

macod15739
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views4 pages

MongoDB Installation

The document provides instructions for installing MongoDB on Ubuntu, MacOS, and Windows. It details the steps to import keys, create a list file, update packages, install MongoDB, start the MongoDB service, and begin using MongoDB.

Uploaded by

macod15739
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

MongoDB Installation

Ubuntu
1. Import the public key used by the package management
system.

sudo apt-key adv --keyserver


hkp://keyserver.ubuntu.com:80 --recv
9DA31620334BD75D9DCB49F368818C72E52529D4

2. Create a list file for MongoDB.

Ubuntu 18.04 -
echo "deb [ arch=amd64 ]
https://repo.mongodb.org/apt/ubuntu bionic/mongodb-
org/4.0 multiverse" | sudo tee
/etc/apt/sources.list.d/mongodb-org-4.0.list

Ubuntu 16.04 -
echo "deb [ arch=amd64,arm64 ]
https://repo.mongodb.org/apt/ubuntu xenial/mongodb-
org/4.0 multiverse" | sudo tee
/etc/apt/sources.list.d/mongodb-org-4.0.list

3. Reload local package database.

sudo apt-get update

4. Install the MongoDB packages.

sudo apt-get install -y mongodb-org


5. Start MongoDB.

sudo service mongod start

6. Begin using MongoDB.

mongo

7. Stop MongoDB.

sudo service mongod stop

MacOS

1. Install Homebrew

/usr/bin/ruby -e "$(curl -fsSL


https://raw.githubusercontent.com/Homebrew/install/maste
r/install)"

2. Tap the MongoDB Homebrew Tap

brew tap mongodb/brew

3. Install MongoDB

brew install mongodb-community@4.0

4. Run MongoDB

brew services start mongodb


5. Connect and Use MongoDB

mongo

Windows

1. Download the MongoDB MSI Installer Package

download the current version of MongoDB and package


server.
https://www.mongodb.com/download-center/community

2. Install MongoDB with the Installation Wizard

a. Click Next to start installation.


b. Accept the licence agreement then click Next.
c. Select the Complete setup.
d. Select “Run service as Network Service user” and
make a note of the data directory, we’ll need this
later.
e. Click Install to begin installation.
f. Hit Finish to complete installation.

3. Setup Alias Shortcuts for Mongo and Mongod

Once installation is complete, we’ll need to set up


MongoDB on the local system.
a. Open Start
b. Type Environment Variables and click on edit
environment variables and path
c. Inside System variables, click on path
d. In the next window click on new.
e. Add a new path
C:\Program Files\MongoDB\Server\{MongoDB
Version}\bin
Where MongoDB Version is the mongoDB version
installed on your system
For e.g.
C:\Program Files\MongoDB\Server\4.1\bin

4. Verify That Setup was Successful


a. Check by mongo --version or mongod --version

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy