How to install MongoDB 3.4 on Linux Mint 18.1 Serena

2191
Share:
how-to-install-mongodb-3-4-on-linux-mint-18-1-serena

Question

How to install MongoDB 3.4 on Linux Mint 18.1 Serena?

Answer

Ubuntu comes with its own official MongoDB package, but with older version:

$ mongo --version
MongoDB shell version: 2.6.10

To install a more up-to-date version, use official MongoDB Community Edition package.

  1. Import the public key used by the package management system.
    The Ubuntu package management tools (i.e. dpkg and apt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. Issue the following command to import the MongoDB public GPG Key:
    $ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
  2. Create a list file for MongoDB.
    Create the /etc/apt/sources.list.d/mongodb-org-3.4.list list file using the command appropriate for your version of Ubuntu:
    $ echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
  3. Reload local package database.
    Issue the following command to reload the local package database:
    $ sudo apt-get update
  4. Install the MongoDB packages.
    To install the latest stable version of MongoDB, issue the following command:
    $ sudo apt-get install -y mongodb-org
  5. Start MongoDB.
    Issue the following command to start mongod:
    $ sudo service mongod start
  6. Verify that MongoDB has started successfully.
    Verify that the mongod process has started successfully by checking the contents of the log file at /var/log/mongodb/mongod.log for a line reading
    [thread1] waiting for connections on port <port>
    where <port> is the port configured in /etc/mongod.conf, 27017 by default.
  7. Enjoy
Tags
Share:

0 comment

Leave a reply

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