// plain
- Install MongoDB on Ubuntu using the official MongoDB repository:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
- Update the packages list and install the MongoDB package:
sudo apt-get update
sudo apt-get install -y mongodb-org
- Start MongoDB:
sudo service mongod start
- Check the status of MongoDB:
sudo service mongod status
- You can now connect to MongoDB using the mongo shell:
mongo
group: install
onelinerhub: How to install MongoDB on Ubuntu?