Remove mongodb-org package:
Uninstall MongoDB
Remove the existing mongodb.list:
Create the MongoDB repository list file:
If you execute the command "
apt update
" you might get the following error:
So first, you need to add the MongoDB key:
Install MongoDB:
You can find the MongoDB puclic key ("
4B7C549A058F8B6B
")
by visiting the Ubuntu key server
http://keyserver.ubuntu.com
- Enter the "OpenPGPkeyserver": MongoDB
- Click "Search Key".
- In the search result page, find the version "4.2" and look for the last up-to-date key.