MongoDB can be easily installed on any platform. On Ubuntu 18.04, we need to perform some steps before running the apt-get command:
sudo apt-get update
sudo apt-get install -y mongodb
Once you've installed it, check whether the mongo process is running. If not, you can start the MongoDB daemon using the following command:
systemctl start mongod
If the user is root, you can drop the sudo keyword before each command.
We can also download MongoDB manually from the website and copy it to /usr/local/bin. To do this, we have to create an init script for the server since the server stops when the system is shut down. We can use the nohup tool to run the server in the background. Usually, it is better to install it using apt-get.
To install MongoDB on Mac OS X, you'll need to use the Homebrew software. Follow these steps to do so:
- We can...