Created
September 17, 2014 15:31
-
-
Save cajones/ffa0bb18652f5c4698f5 to your computer and use it in GitHub Desktop.
WIndows MongoDB install script
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
function Download-File($url, $file) { | |
Write-Host $url | |
$webclient = New-Object System.Net.WebClient | |
$webclient.DownloadFile($url, $file) | |
return $file | |
} | |
$mongoInstaller = 'C:\temp\mongodb-windows-installer.msi' | |
if(!(Test-Path $mongoInstaller)) { | |
$osArchitecture = (wmic os get osarchitecture) | ? { $_ -like '*-bit*'} | |
if($osArchitecture = '64-bit') { | |
Write-Host 'Downloading Mongodb for 64-bit windows...' | |
$downloadUrl = 'https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.6.4-signed.msi' | |
} else { | |
Write-Host 'Downloading Mongodb for 32-bit windows...' | |
$downloadUrl = 'https://fastdl.mongodb.org/win32/mongodb-win32-i386-2.6.4-signed.msi' | |
} | |
New-Item -type directory -force c:\temp | Out-Null | |
Download-File $downloadUrl $mongoInstaller | |
} | |
. $mongoInstaller /passive | |
New-Item -type directory -force 'C:\data\db' | |
New-Item -type directory -force 'C:\Program Files\MongoDB\log' | |
#TODO install as service | |
. 'C:\Program Files\MongoDB 2.6 Standard\bin\mongod.exe' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment