How to install MongoDB 3.6 on Linux Mint 18.3 Sylvia

10601
Share:
how-to-install-mongodb-3-6-on-linux-mint-18-3-sylvia

Although Ubuntu has its own official MongoDB package, there are chances that we need to install more updated version. As the time of this writing, the latest version of MongoDB available is 3.6. Follow these steps to install MongoDB Community Edition package on Linux Mint 18.3 Sylvia:

  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 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5

  2. Create a list file for MongoDB.
    Create the /etc/apt/sources.list.d/mongodb-org-3.6.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.6 multiverse" \
    | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.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.
    Next step is to 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. Now you have a working installation of MongoDB 3.6 on your Linux Mint 18.3 Sylvia.

Final Words

Well, that's it. I hope that you now know how to install MongoDB 3.6 on Linux Mint 18.3 Sylvia. If you run into any issues or have any feedback feel free to drop a comment below.

 

Tags
Share:

1 comment

  1. After I followed these instructions, my mongod didn't start up. Aji gave me a pointer: I skipped the data migration as I assumed mongodb does it by magic. Previously I ran the original version 2.6 (or so) from the mint distro.

    Aji, I executed the snippet you sent me:

    sudo mv /var/lib/mongodb /var/lib/mongodb_bak
    sudo mkdir /var/lib/mongodb
    sudo chmod 755 /var/lib/mongodb
    sudo chown mongodb:mongodb /var/lib/mongodb
    sudo systemctl restart mongodb

    I migrated the data with mongoexport/mongoimport.

    Works perfectly now. Thanks a lot Aji

Leave a reply

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