Debian 11 Debian 10 Other OS
Note: This manual is for Debian 11 only, if you have a different version of the system, please use the official documentation .
Adding keys:
Copy sudo apt-get install -y gnupg
Copy curl -fsSL https://pgp.mongodb.com/server-6.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg \
--dearmor
Copy echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg] http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
Installation:
Copy apt-get install -y mongodb-org
Starting and adding to autorun:
Copy sudo systemctl start mongod
Copy sudo systemctl daemon-reload
Copy sudo systemctl enable mongod
Creating a database and password:
continue with the instructions below
Attention: The instructions are for Debian 10 only, if you have a different version of the system, please use the official documentation.
Adding keys:
Copy sudo apt-get install -y gnupg
Copy curl -fsSL https://pgp.mongodb.com/server-6.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg \
--dearmor
Copy echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] http://repo.mongodb.org/apt/debian buster/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
Installation:
Copy sudo apt-get install -y mongodb-org
Starting and adding to autorun:
Copy sudo systemctl start mongod
Copy sudo systemctl daemon-reload
Copy sudo systemctl enable mongod
Creating a database and password:
continue with the instructions below...
Copy use admin;
db .createUser ({
user : "ADMIN_NAME" ,
pwd : "ADMIN_PASSWORD" ,
roles : [ { role : "userAdminAnyDatabase" , db : "admin" } ]
});
use DB_NAME ;
db .createUser ({
user : "USER_NAME" ,
pwd : "YOUR_PASSWORD" ,
roles : [ { role : "readWrite" , db : "DB_NAME" } ]
});
exit
Copy security :
authorization : "enabled"