-
Notifications
You must be signed in to change notification settings - Fork 0
MongoDB Setup
-
Check Installation Instructions
Refer to the MongoDB Community Server installation instructions for detailed steps. -
Mongosh Installation Issue on Fedora
Most of the time,Mongosh
is installed automatically. However, on Fedora, there might be an issue withopenssl
, resulting in the following error:niklaus@fedora ~ mongosh mongosh: OpenSSL configuration error: 40A85B6A297F0000:error:030000A9:digital envelope routines:alg_module_init:unknown option:…/deps/openssl/openssl/crypto/evp/evp_cnf.c:61:name=rh-allow-sha1-signatures, value=yes
Solution:
Run the commandsudo dnf swap mongodb-mongosh mongodb-mongosh-shared-openssl3
. Ensure that you have installedmongodb-org
andmongodb-org-server
from the official repository before swappingmongodb-mongosh
. -
Start MongoDB Service
Start themongod
service by executing:sudo systemctl start mongod
-
Create Root User for MongoDB
Follow the instructions here to create a root user. Below is an example of how to create a user:db.createUser({ user: "<name>", pwd: passwordPrompt(), // Or "<cleartext password>" roles: [ { role: "<role>", db: "<database>" } | "<role>", ... ], })
-
Enable Authentication
To require a username and password for connecting to the MongoDB server, modify the/etc/mongod.conf
file as follows:security: authorization: "enabled"
Then restart the service with:
sudo systemctl restart mongod
-
Add Environment variable Change the value of
DATABASE_URI
tomongodb://myDatabaseUser:D1fficultP%[email protected]:27017