How To Install MongoDB On Ubuntu 16.04 - DigitalOcean
How To Install MongoDB On Ubuntu 16.04 - DigitalOcean
How To Install MongoDB On Ubuntu 16.04 - DigitalOcean
Introduction
Prerequisites
To follow this tutorial, you will need:
One Ubuntu 16.04 server set up by following this initial server setup
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04 Page 1 of 5
How to Install MongoDB on Ubuntu 16.04 | DigitalOcean 7/12/19, 12(42
Output
Next, we have to add the MongoDB repository details so apt will know
where to download the packages from.
After adding the repository details, we need to update the packages list.
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04 Page 2 of 5
How to Install MongoDB on Ubuntu 16.04 | DigitalOcean 7/12/19, 12(42
This command will install several packages containing latest stable version
of MongoDB along with helpful management tools for the MongoDB server.
You can also use systemctl to check that the service has started properly.
Output
The last step is to enable automatically starting MongoDB when the system
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04 Page 3 of 5
How to Install MongoDB on Ubuntu 16.04 | DigitalOcean 7/12/19, 12(42
starts.
The MongoDB server is now configured and running, and you can manage
the MongoDB service using the systemctl command (e.g. sudo systemctl
stop mongod, sudo systemctl start mongod).
If you intend to use the MongoDB server only locally with applications
running on the same server, it is a recommended and secure setting.
However, if you would like to be able to connect to your MongoDB server
from the internet, we have to allow the incoming connections in ufw.
To allow access to MongoDB on its default port 27017 from everywhere, you
could use sudo ufw allow 27017. However, enabling internet access to
MongoDB server on a default installation gives unrestricted access to the
whole database server.
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04 Page 4 of 5
How to Install MongoDB on Ubuntu 16.04 | DigitalOcean 7/12/19, 12(42
You should see traffic to 27017 port allowed in the output.If you have
decided to allow only a certain IP address to connect to MongoDB server,
the IP address of the allowed location will be listed instead of Anywhere in
the output.
Output
Status: active
To Action From
-- ------ ----
27017 ALLOW Anywhere
OpenSSH ALLOW Anywhere
27017 (v6) ALLOW Anywhere (v6)
OpenSSH (v6) ALLOW Anywhere (v6)
Conclusion
You can find more in-depth instructions regarding MongoDB installation and
configuration in these DigitalOcean community articles.
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04 Page 5 of 5