Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

1.

Installing MongoDB community Edition on Ubuntu


2. Installing the MongoDB C Driver (libmongoc) and BSON library (libbson)
2.1. Starting MongoDB

1/4
1. Installing MongoDB community Edition on Ubuntu
Import the public key used by the package management system.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv


9DA31620334BD75D9DCB49F368818C72E52529D4

Create a list file for MongoDB.

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

Reload local package database.

sudo apt-get update

Install the MongoDB packages.

sudo apt-get install -y mongodb-org

ulimit Considerations.
The following thresholds and settings are particularly important for mongod and mongos deployments:

* File sie : ulimit -f unlimited


* CPU Time : ulimit -t unlimited
* Virtual Memory : ulimit -v unlimited
* Locked-in-memory size: ulimit -l unlimited
* Open files : ulimit -n 64000
* Memory size : ulimit -m unlimited
* Processes/Threads : ulimit -u 64000

Start MongoDB

sudo service mongod stop

2. Installing the MongoDB C Driver (libmongoc) and BSON library


(libbson)

2/4
Prerequisites for libmongoc

sudo apt-get install cmake libssl-dev libsasl2-dev -y

Install libmongoc with a Package Manager

sudo apt-get install libmongoc-1.0-0 -y

Install libbson with a Package Manager

sudo apt-get install libbson-1.0 -y

3/4
2.1. Starting MongoDB

To run the examples in this tutorial, MongoDB must be installed and running on localhost on the default port,
27017. To check if it is up and running, connect to it with the MongoDB shell.

mongo --host localhost --port 27017

4/4

You might also like