Kategorie: Linux

Installing and securing MongoDB in Debian 11

The following tutorial describes how to install MongoDB in Debian 11.
We will do the whole thing by making a dozen or so entries in the console.

First, we download the necessary packages, we add the pgp key and get the mongoDB repositories

apt-get install curl apt-transport-https software-properties-common gnupg2 -y
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add -
echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main" | tee /etc/apt/sources.list.d/mongodb-org.list

We update the package list and install mongoDB

apt-get update -y
apt-get install mongodb-org -y

Run it on your system:

systemctl start mongod
systemctl enable mongod

We can check the version of Mongodb by issuing the command:

mongod --version

the result of the:

db version v4.4.9
Build Info: {
    "version": "4.4.9",
    "gitVersion": "b4048e19814bfebac717cf5a880076aa69aba481",
    "openSSLVersion": "OpenSSL 1.1.1k  25 Mar 2021",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "debian10",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}

Now we will enable authorization in mongoDB

We execute the command:

mongo

And we connect:

> use admin

We create the base:

> db.createUser(
{
user: "madmin",
pwd: "password",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)

the result of the:

Successfully added user: {
 "user" : "madmin",
 "roles" : [
  {
   "role" : "userAdminAnyDatabase",
   "db" : "admin"
  }
 ]
}

We exit using the CRTL shortcut + D

We edit the configuration file:

nano /etc/mongod.conf

And change:

security:
 authorization: enabled

The last step is to reload the service:

systemctl restart mongod

Linux

Udostępnij
Opublikowane przez
Linux

Recent posts

KeePass2 2.52 w Ubuntu 22.04

The guide below describes how to install KeePass on Ubuntu. Całość wykonamy za pomocą kilku poleceń

2 years temu

Installing Master PDF editor in Ubuntu 22.04

Master PDF Editor is a comprehensive PDF program, which includes many features. Oprócz tworzenia i edycji

2 years temu

iotop - memory monitoring

Iotop jest prostym narzędziem dla systemów Uniksowych umożliwiającym monitorowanie użycia dowolnego nośnika pamięci flash/hdd/ssd w

2 years temu

Run multiple commands in one cron job

You can separate two or more commands with semicolons (;), Semicolon (;): służy do oddzielania

2 years temu

Changing the exif data of a photo in the Linux terminal

Poniższy poradnik opisuje w jaki sposób za pomocą konsoli możemy dokonać edycji danych zdjęcia exif.

2 years temu

Installing Rocket.Chat Server on Rocky Linux 8

The following guide describes how to install Rocket.Chat on Rocky Linux 8 Całość bardzo prosto zainstalujemy

2 years temu