1. Go to the URL : https://www.mongodb.com/download-center/community/releases/archive
2. Select Software for your computer e.g: for Windows , shown below

4. Download it into a repository, and extract it into an installation directory.
5. Create data directories for installation:
Note: it must be in YAML format that is 3 space from left end.
7. We need to give user(a service account) full access to this installation directory, form the same we will use this command:
Icacls d:\mongo /grant Avinash:(OI)(CI)F
8. Now, install mongo db as service on windows server , using command:
mongod --install --config d:\mongo\config\mongod.conf --serviceUser Avinash --servicePassword *******
9. Now, we will verify whether it is installed or not.
sc qc mongodb
10. We will start the mongodb service now, by running the command:
net start mongodb
11. Create a db:
5. Create data directories for installation:
- D:/Mongo/Data – for data files
- D:/Mongo/Log – for log files
- D:/Mongo/Config – for configuration files
storage:
dbPath: "C:/Mongo/Data"
systemLog:
destination: file
path: "C:/Mongo/Log/mongod.log"
Note: it must be in YAML format that is 3 space from left end.
7. We need to give user(a service account) full access to this installation directory, form the same we will use this command:
Icacls d:\mongo /grant Avinash:(OI)(CI)F
8. Now, install mongo db as service on windows server , using command:
mongod --install --config d:\mongo\config\mongod.conf --serviceUser Avinash --servicePassword *******
9. Now, we will verify whether it is installed or not.
sc qc mongodb
10. We will start the mongodb service now, by running the command:
net start mongodb
11. Create a db:
use my_test_db
12. Create a user:
db.createUser(
{
user: "avinashthakur",
pwd: "Bangalore#12345",
roles: [
{ role: "readWrite", db: "my_test_db" },
{ role: "readWrite", db: "test" },
{ role: "readWrite", db: "admin" }
]
}
)
13.It is ready to use. You may follow my other article for CRUD operation in Mongodb
No comments:
Post a Comment