How To Install Newer Version of MongoDB on Debian 8

MongoDB is a document-based, general-purpose distributed database designed for modern application developers and for the cloud computing era. No database makes you more productive. In this article, we will look at how to install the latest version of MongoDB

Add MongoDB Public Key

This command adds the GPG MongoDB public key to the system key list:

apt-key adv --keyserver --recv 7F0CEB10

This key is necessary in order to ensure the consistency and authenticity of all packages.

Add MongoDB Storage

First you need to create the mongodb.list file to add the MongoDB repository to the system. You can do this with the following command:

echo "deb "$(lsb_release -sc)"/mongodb-org/3.0 main" | tee /etc/apt/sources.list.d/mongodb-org-3.0.list

Package Updates

To get information about the latest packages, please nter the command:

apt-get update

Install MongoDB packages

To install the latest stable version of MongoDB, use the following command:

apt-get install -y mongodb-org
  • mongodb-org-server
  • mongodb-org-mongos
  • mongodb-org-shell
  • mongodb-org-tools

*Here are 4 packages that mongodb-org automatically install

Launch MongoDB

After installation is complete, MongoDB starts automatically. If you need to manually start the MongoDB server, use the following command:

service mongod start

To stop and restart mongodb processes, use this commands:

service mongod stop
service mongod restart

You can access the MongoDB shell by running the following command: (this allows you to connect to the MongoDB server)


When the shell starts, you will see the output in the following format:

MongoDB shell version: 3.0.0
connecting to: test

Was this article helpful?

Related Articles

Leave A Comment?