writer
544
edits
Line 157: | Line 157: | ||
=====Installation on Linux system===== | =====Installation on Linux system===== | ||
Installation on Debian | |||
https://www.mongodb.com/docs/v6.0/tutorial/install-mongodb-on-debian/ | |||
https://www.mongodb.com/docs/mongodb-shell/install/ | |||
a. Pre-requisites | |||
Packages: gnupg2, wget, sudo, net-tools, curl | |||
b. MongoDB installation | |||
* Add MongoDB server key | |||
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add – | |||
* Add MongoDB repository | |||
Debian 11 | |||
echo "deb http://repo.mongodb.org/apt/debian bullseye/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list | |||
Debian 10 | |||
echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list | |||
Debian 9 | |||
echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list. | |||
* Install MongoDB | |||
sudo apt-get update | |||
sudo apt-get install -y mongodb-org | |||
sudo apt-get install -y mongodb-mongosh | |||
c. Configure MongoDB | |||
Copy file from package folder debian/mongod.conf to /etc/mongod.conf. It enables compression which is needed for Monitoring. If you want to secure the connection to MongoDB, allowing specific IP address or change port ''etc''., you can edit this file. Documentation is available on official website: | |||
https://www.mongodb.com/docs/manual/reference/configuration-options/ | |||
d. Enable MongoDB as a service | |||
systemctl enable mongod.service | |||
e. Create an admin user | |||
mongo | |||
use admin | |||
db.createUser({ user: "oros" , pwd: "oros", roles: ["userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase"]}) | |||
f. Start MongoDB | |||
sudo systemctl start mongod | |||
====Database management==== | ====Database management==== |