MongoDB is a free and open-source NoSQL document database used commonly in modern web applications. This tutorial will help you set up MongoDB on your server for a production application environment.
To follow this tutorial, you will need
A sudo non-root user, which you can set up by following this:
Create new user:
adduser name_of_new_user
To add "sudo" privileges to our new user, we need to add the new user to the "sudo" group. By default, on Ubuntu/Debian, users who belong to the "sudo" group are allowed to use the sudo command. Run this command to add your new user to the sudo group:
gpasswd -a name_of_new_user sudo
Then login as new user, just execute:
su name_of_new_user
Importing the Public Key
In this step, we will import the MongoDB GPG public key.
MongoDB is already included in Ubuntu package repositories, but the official MongoDB repository provides most up-to-date version and is the recommended way of installing the software. Ubuntu ensures the authenticity of software packages by verifying that they are signed with GPG keys, so we first have to import they key for the official MongoDB repository.