Installing MongoDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$msiPath = "$($env:USERPROFILE)\mongodb-win32-x86_64-2008plus-ssl-3.0.4-signed.msi" | |
(New-Object Net.WebClient).DownloadFile('https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-3.0.4-signed.msi', $msiPath) | |
cmd /c start /wait msiexec /q /i $msiPath INSTALLLOCATION=C:\mongodb ADDLOCAL="all" | |
del $msiPath | |
mkdir c:\mongodb\data\db | Out-Null | |
mkdir c:\mongodb\log | Out-Null | |
'systemLog: | |
destination: file | |
path: c:\mongodb\log\mongod.log | |
storage: | |
dbPath: c:\mongodb\data\db' | Out-File C:\mongodb\mongod.cfg -Encoding utf8 | |
cmd /c start /wait sc create MongoDB binPath= "C:\mongodb\bin\mongod.exe --service --config=C:\mongodb\mongod.cfg" DisplayName= "MongoDB" start= "demand" | |
& c:\mongodb\bin\mongod --version | |
Start-Service mongodb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment