What to do next after install mongo on server?

After installing Mongo on Ubuntu Server using instruction here https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

You’ll probably need to…

1/ Modify configuration file for remote connection

Do several steps in this link https://docs.mongodb.com/manual/tutorial/configure-scram-client-authentication/

To complete create administrator user at step https://docs.mongodb.com/manual/tutorial/configure-scram-client-authentication/#create-the-user-administrator you can use this command to get strong password

date +%s | sha256sum | base64 | head -c 32 ; echo


Open file at /etc/mongod.conf replace with following content

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
  dbPath: /var/lib/mongodb
    enabled: true
#  engine:
#  wiredTiger:

# where to write logging data.
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
  port: 27017

# how the process runs
  timeZoneInfo: /usr/share/zoneinfo

  authorization: 'enabled'




## Enterprise-Only Options:



And restart service mongo by execute command:

sudo systemctl restart mongod

Don’t forget to allow connection from firewall but not disrupt SSH connection by using following command

sudo ufw allow 22
sudo ufw allow 27017
sudo ufw enable
sudo ufw reload

Retart Ubuntu Server to trigger change

sudo init 6

After Ubuntu Server restarted open Mongo Compass and pass connection string to test connection


Check it out!