How to install mongodb on ubuntu

Publish : 2022 May 25 695 view Cat : AVANETCO + Database + Linux
install mongodb
5/5 - (3 votes)

mongodb popularity has become number one choice of production in cloud environment and so many scalable companies, so with no further ado lets see How to install mongodb on ubuntu

mongodb is SCHEMALESS so it is so fast and it uses documents that are so close to human language thus is pretty easy to work with. the table below can be a good reference to seen in which environment which database is right for you.

install mongodb

to install mongodb on ubuntu you need to have a user with root privileges and configure firewall:

add a user : adduser mongo
add it to sudoers group :usermod -aG sudo mongo

allow SSH connection anf then enable whatever firewall you are using:

ufw allow OpenSSH

ufw enable

now install the package:

sudo apt update

sudo apt install mongodb-org

then start the service and then enable it so that it stars automatically after boot up:

sudo systemctl start mongod.service

sudo systemctl enable mongod

to verify installation run:

mongo --eval 'db.runCommand({ connectionStatus: 1 })'