How to install mongodb on ubuntu

install mongodb
5/5 - (4 votes)

MongoDB has become a popular choice for production workloads in cloud environments and at many fast-scaling companies. Here’s how to install MongoDB on Ubuntu.

MongoDB is schemaless, which makes it fast, and it stores data as documents that read close to plain language, so it is easy to work with.

To install MongoDB on Ubuntu, you need a user with root privileges and a configured firewall:

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

Allow SSH connections, then enable whichever firewall you use:

ufw allow OpenSSH
ufw enable

Now install the package:

sudo apt update
sudo apt install mongodb-org

Next, start the service and enable it so it starts automatically after boot:

sudo systemctl start mongod.service
sudo systemctl enable mongod

To verify the installation, run:

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

Related articles

nslookup practical commands

Anyone who works in IT has run into a failed DNS request at least once, and it can be frustrating. In this…