3 Easy Steps to properly install MongoDB on your Ubuntu 18.04 LTS
So, what is MongoDB?
MongoDB is a cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schema. MongoDB is developed by MongoDB Inc. and licensed under the Server Side Public License (SSPL).
There are already a lot of articles and blog posts about why to use MongoDB instead of RDBMS, such as MySQL, MariaDB, PostgreDB, etc... And the intention of this post is NOT to glorify (again) the good of MongoDB, but to show people how easy to install MongoDB on your existing Ubuntu distributions.
In just 3 easy steps, you can get your MongoDB installed in no time:
1) Thoguth a terminal or a shell, type
# sudo apt update
this is to update your package repository so you will pull the latest MongoDB
2) Installing MongoDB
# sudo apt install mongo-tools mongodb mongodb-clients mongodb-dev mongodb-server mongodb-server-core
this will install all of the needed packages for a *complete* MongoDB installation. Why not just do a 'apt install mongodb' and let apt figure things out? Because my experience with that is MongoDB would never get install properly - missing /etc/mongodb.conf, missing default database files in /var/lib/mongodb, mongodb wouldn't start, etc... Basically, just tons of weird issues and problems that should not have happened in the first place.
So, trust me ! do the commands like I've listed above to save you a lot of headaches !
3) Double check the installation
# sudo systemctl status mongodb
When everything has been installed properly, you will see something like this:
You have now installed MongoDB on your Ubuntu !!