How do you install MongoDB 5.0 on Ubuntu 20.04 with apt-get?

I'm wondering how to install the latest MongoDB version 5.0 via apt-get to avoid having to spend time on the mongodb official website and enter any personal information.

1 Answer

  1. Add the mongo pgp key:

curl -fsSL | sudo apt-key add -

  1. Add the mongodb source list

echo "deb [ arch=amd64,arm64 ] bionic/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list

  1. Run update to update local sources list

sudo apt update

  1. Install the mongodb package

sudo apt install mongodb-org

  1. Start the mongodb servicde

sudo systemctl start mongod.service

  1. Verify the service is running

sudo systemctl status mongod

  1. Configure mongodb to start on startup

sudo systemctl enable mongod

  1. Verify the mongo shell is installed and that you can connect to your local mongodb instance

mongo --eval 'db.runCommand({ connectionStatus: 1 })'

Source:

Modified versions from 4.4 to 5.0.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like