Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save antonioj-mattos/4a5fbab6534e47cfe348 to your computer and use it in GitHub Desktop.

Select an option

Save antonioj-mattos/4a5fbab6534e47cfe348 to your computer and use it in GitHub Desktop.
#Make sure 7za is installed
choco install 7zip.commandline
# Create mongodb and data directory
md $env:temp\mongo\data
# Go to mongodb dir
Push-Location $env:temp\mongo
# Download zipped mongodb binaries to mongodbdir
Invoke-WebRequest https://fastdl.mongodb.org/win32/mongodb-win32-i386-2.6.7.zip?_ga=1.44958753.446619509.1416081281 -OutFile mongodb.zip
# Extract mongodb zip
cmd /c 7za e mongodb.zip
# Install mongodb as a windows service
cmd /c $env:temp\mongo\mongod.exe --logpath=$env:temp\mongo\log --dbpath=$env:temp\mongo\data\ --smallfiles --install
# Sleep as a hack to fix an issue where the service sometimes does not finish installing quickly enough
Start-Sleep -Seconds 5
# Start mongodb service
net start mongodb
# Return to last location, to run the build
Pop-Location
Write-Host
Write-Host "monogdb installation complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment