Upgrading to MongoDB 3.6 on Ubuntu 16.04 LTS

MongoDB 3.6
MongoDB 3.6

Introduction

This guide shows you how to upgrade your MongoDB to version 3.6 on your Ubuntu server.

Prerequisites

  • A running MongoDB.
  • Basic knowledge of Linux OS.

Step-by-step guide

  1. SSH into your Ubuntu server

  2. Import the v3.6 public key used by the package management system

    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
    
  3. Create a list file for MongoDB v3.6

    echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
    
  4. Reload the local package database

    sudo apt-get update
    
  5. Update to the latest stable version of MongoDB

    sudo apt-get install -y mongodb-org
    
  6. Check the result

    mongod --version
    

    You should see "db version v3.6.0"

Conclusion

Congratulations! You now have MongoDB 3.6.0 installed on your Ubuntu server.