Install MongoDB 4 on Debian 9

You can see detailed instruction on how to install on MongoDB web site.

First add key

For Debian 8, run

For Debian 9, run

Now install mongoDB with

Once installed, you can check version with

Enable MongoDB start on boot

To start/stop mongodb