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
- Add the mongo pgp key:
curl -fsSL | sudo apt-key add -
- 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
- Run update to update local sources list
sudo apt update
- Install the mongodb package
sudo apt install mongodb-org
- Start the mongodb servicde
sudo systemctl start mongod.service
- Verify the service is running
sudo systemctl status mongod
- Configure mongodb to start on startup
sudo systemctl enable mongod
- 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.