To install MongoDB on Ubuntu 20.04 on DigitalOcean, follow these steps:
- Connect to your DigitalOcean droplet via SSH.
- Update the package list:
sudo apt update
- Install MongoDB:
sudo apt install mongodb
- Start the MongoDB service:
sudo systemctl start mongodb
- Verify that MongoDB has started successfully:
sudo systemctl status mongodb
You should see a message indicating that the service is active and running.
- (Optional) Enable the MongoDB service to start automatically at boot:
sudo systemctl enable mongodb
- (Optional) Verify that the MongoDB service has been set to start automatically at boot:
sudo systemctl is-enabled mongodb
You should see a message indicating that the service is enabled.
That’s it! You should now have MongoDB installed and running on your Ubuntu 20.04 DigitalOcean droplet.