To install MongoDB on Ubuntu 20.04 on DigitalOcean, follow these steps:

  1. Connect to your DigitalOcean droplet via SSH.
  2. Update the package list:
sudo apt update
  1. Install MongoDB:
sudo apt install mongodb
  1. Start the MongoDB service:
sudo systemctl start mongodb
  1. Verify that MongoDB has started successfully:
sudo systemctl status mongodb

You should see a message indicating that the service is active and running.

  1. (Optional) Enable the MongoDB service to start automatically at boot:
sudo systemctl enable mongodb
  1. (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.

Similar Posts