Kategorie: Linux

Installing Ubuntu MongoDB 18.04

Today I present a guide so that in a few steps install MongoDB on our server with Ubuntu.
Feel free to read.

At the beginning we make an update repositories

apt-get update

Then we install MongoDB

apt-get install -y mongodb

Check the server status MongoDB command:

sudo systemctl status mongodb

the result of the:

● mongodb.service - An object/document-oriented database
   Loaded: loaded (/lib/systemd/system/mongodb.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2018-05-26 07:48:04 UTC; 2min 17s ago
     Docs: man:mongod(1)
 Main PID: 2312 (mongod)
    Tasks: 23 (limit: 1153)
   CGroup: /system.slice/mongodb.service
           └─2312 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/mongodb.conf

Which indicates that the server is running correctly.

To confirm this connection we make a diagnostic command:

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

We should get the result as below:

MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.3
{
        "authInfo" : {
                "authenticatedUsers" : [ ],
                "authenticatedUserRoles" : [ ]
        },
        "ok" : 1

If you use the firewall must add a port to exceptions in the case of UFW:

sudo ufw YOUR IP ADDRESS / 32 port e.g.: 27017  

Command

sudo ufw status

This will allow us to verify whether a connection on this port is open:

Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
27017                      ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
27017 (v6)                 ALLOW       Anywhere (v6)

To allow remote connection, edit the file:/etc/mongodb.conf

nano /etc/mongodb.conf

And set:

...
logappend=true

bind_ip = 127.0.0.1,IP TWOJEGO SERWERA
#port = 27017

...

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