There are different ways to install MongoDB on the different operating systems but I am showing only for ubuntu and Window. There are two ways of installing MongoDB on Ubuntu systems.
MongoDB install in Ubuntu
1) Install MongoDB from apt repository
2) Install MongoDB from a downloaded.deb package
but I am representing through command base
Step 1:- Import MongoDB public GPG Key:
Before you can install any package from MongoDB apt repository, you need to download and import GPG key to your system.
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
Step 2:- Add MongoDB 4 APT Repository on Ubuntu 18.04 / Ubuntu 16.04
Ubuntu 18.04:
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
Ubuntu 16.04:
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
Step 3:- Install MongoDB 4 on Ubuntu 18.04 / Ubuntu 16.04
sudo apt update
sudo apt install -y mongodb-org
The service name is mongod now you can start the application by below command:
sudo systemctl enable --now mongod
Check Mongo status
sudo systemctl status mongod
Note:- If it is showing active (running) means MongoDB is running perfectly.
MongoDB install in Window
Step1:-Firstly click on the URL https://www.mongodb.com/try/download/community after that select the version and select the Platform as a Window and select the package as msi after that click on download button.
Step2:- Now, double click on the msi file which is installed after that click on the next button.
Step3:- Now, click the next button.
Step4:- Now, You can change the path, where you want to install otherwise it will be install on C drive and after that click the next button.
Step5:- Now, click the next button.
Step6:- Now, click the install button.
Step7:- Now, MongoDB is started to installing.
Step8:- Now, MongoDB is installing is going on.
Step9:- Now, MongoDB Compass is loading.
Step8:- Now, MongoDB is installed and click on the finish button.