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

Finally

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.
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
#  engine:
#  wiredTiger:

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

# network interfaces
net:
  port: 27017
  bindIp: 0.0.0.0


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

security:
  authorization: 'enabled'

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:

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

mongodb://username:password@server-public-ip:27017/?authSource=admin&authMechanism=SCRAM-SHA-256&readPreference=primary&appname=MongoDB%20Compass&directConnection=true&ssl=false

Check it out!