Install MongoDB Latest Version on Ubuntu Server

MongoDB for Ubuntu available from the official Ubuntu package repository. But we can install More Up to date latest MongoDB package provides by the official MongoDB developers.

Do the following steps to To install the latest version of MongoDB Server on Ubuntu.

  1. Import MongoDB Public GPG Key.
  2. Create the MongoDB apt source list file.
  3. Install MongoDB with apt-get install command.

First, import the GPG Key:

sudo apt-key adv --keyserver hkp:// --recv 0C49F3730359A14518585931BC711F9BA15703C6

Next, Create the apt repository:

For Ubuntu 16.04:

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

For Ubuntu 14.04:

echo "deb [ arch=amd64 ] trusty/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

Then, Update the apt source list and install the mongodb-org package:

sudo apt-get update
sudo apt-get install mongodb-org

Finally, Start and enable mongod.service service:

systemctl start mongod.service
systemctl enable mongod.service

Login to the mongo shell, Type: