mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 14:03:28 -04:00
added a powershell script for windows developers to install mongodb and add it as a service.
This commit is contained in:
parent
01efb2f92b
commit
502675e64f
1 changed files with 39 additions and 0 deletions
39
scripts/windows/install-mongodb.ps1
Executable file
39
scripts/windows/install-mongodb.ps1
Executable file
|
@ -0,0 +1,39 @@
|
|||
Set-ExecutionPolicy RemoteSigned
|
||||
|
||||
$mongoDbPath = "C:\MongoDB"
|
||||
$mongoDbConfigPath = "$mongoDbPath\mongod.cfg"
|
||||
$url = "http://downloads.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.4.9.zip"
|
||||
$zipFile = "$mongoDbPath\mongo.zip"
|
||||
$unzippedFolderContent ="$mongoDbPath\mongodb-win32-x86_64-2008plus-2.4.9"
|
||||
|
||||
if ((Test-Path -path $mongoDbPath) -eq $True)
|
||||
{
|
||||
write-host "Seems you already installed MongoDB"
|
||||
exit
|
||||
}
|
||||
|
||||
md $mongoDbPath
|
||||
md "$mongoDbPath\log"
|
||||
md "$mongoDbPath\data"
|
||||
md "$mongoDbPath\data\db"
|
||||
|
||||
[System.IO.File]::AppendAllText("$mongoDbConfigPath", "dbpath=C:\MongoDB\data\db`r`n")
|
||||
[System.IO.File]::AppendAllText("$mongoDbConfigPath", "logpath=C:\MongoDB\log\mongo.log`r`n")
|
||||
[System.IO.File]::AppendAllText("$mongoDbConfigPath", "smallfiles=true`r`n")
|
||||
[System.IO.File]::AppendAllText("$mongoDbConfigPath", "noprealloc=true`r`n")
|
||||
|
||||
$webClient = New-Object System.Net.WebClient
|
||||
$webClient.DownloadFile($url,$zipFile)
|
||||
|
||||
$shellApp = New-Object -com shell.application
|
||||
$destination = $shellApp.namespace($mongoDbPath)
|
||||
$destination.Copyhere($shellApp.namespace($zipFile).items())
|
||||
|
||||
Copy-Item "$unzippedFolderContent\*" $mongoDbPath -recurse
|
||||
|
||||
Remove-Item $unzippedFolderContent -recurse -force
|
||||
Remove-Item $zipFile -recurse -force
|
||||
|
||||
& $mongoDBPath\bin\mongod.exe --config $mongoDbConfigPath --install
|
||||
|
||||
& net start mongodb
|
Loading…
Add table
Add a link
Reference in a new issue