HugeServer Knowledgebase

Install MongoDB 3.4 on Debian 8 and Ubuntu 16

Introduction

MongoDB is a scalable, high-performance, open source NoSQL database. The database is document-oriented so it manages collections of JSON-like documents. Many applications can thus model data in a more natural way, as data can be nested in complex hierarchies and still be queryable and indexable.

We are assuming that you have root permission, otherwise, you may start commands with “sudo”.

Installing MongoDB on Debian 8

For installing the latest stable version of MongoDB you should add the MongoDB repository but first, you should Import the public key used by the package management system:

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

Create a file for repositories information with the command below:

touch /etc/apt/sources.list.d/mongodb-org-3.4.list

Inject the repositories information in the file with the command below:

echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list

Update repository list with the command below:

apt-get update

Now we can install MongoDB easily using “apt”:

apt-get install mongodb-org -y

Installing MongoDB on Ubuntu 16

For installing the latest stable version of MongoDB you should add the MongoDB repository but first, you should Import the public key used by the package management system:

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

Create a file for repositories information with the command below:

touch /etc/apt/sources.list.d/mongodb-org-3.4.list

Inject the repositories information in the file with the command below:

echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list

Update repository list with the command below:

apt-get update

Now we can install MongoDB easily using “apt”:

apt-get install mongodb-org -y

Manage your MongoDB Service

You can manage your MongoDB service with “systemctl”:

For make MongoDB to run at startup:

systemctl enable mongod

For Start/Stop MongoDB serivce:

systemctl start mongod

systemctl stop mongod

or

service mongod start

service mongod stop

See your MongoDB status:

systemctl status mongod

or

service mongod status

Checkout official MongoDB website for more information!

Was this tutorial helpful?

Thank you for your vote.Thank you for your vote.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

*