Created
March 31, 2022 19:40
-
-
Save vMarkusK/74f57a81eedb40b535b000b812460f5f to your computer and use it in GitHub Desktop.
Quick and Dirty MinIO Service Setup on Windows OS
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
#Check script run as administrator | |
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit } | |
Set-Location -Path $PSScriptRoot | |
$ninioConolePort = 8443 | |
$minioDataRoot = "C:\minioData" | |
foreach($i in 1..4){ | |
New-Item -ItemType Directory -Path $minioDataRoot -Name $i | |
} | |
Get-NetFirewallRule -DisplayName minio* | Remove-NetFirewallRule -Confirm:$false | |
New-NetFirewallRule -DisplayName minio -Direction Inbound -Profile Any -Action Allow -Protocol TCP -LocalPort 9000, $ninioConolePort -Confirm:$false | |
$config = @" | |
<service> | |
<id>MinIO</id> | |
<name>MinIO</name> | |
<description>MinIO is a high performance object storage server</description> | |
<executable>minio.exe</executable> | |
<env name='MINIO_ROOT_USER' value='minio'/> | |
<env name='MINIO_ROOT_PASSWORD' value='minio123'/> | |
<arguments>server $minioDataRoot\1 $minioDataRoot\2 $minioDataRoot\3 $minioDataRoot\4 --console-address :$ninioConolePort</arguments> | |
<logmode>rotate</logmode> | |
</service> | |
"@ | |
Set-Content "minio-service.xml" $config | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
Invoke-WebRequest -Uri "https://github.com/winsw/winsw/releases/download/v2.8.0/WinSW.NET4.exe" -OutFile "minio-service.exe" | |
Invoke-WebRequest -Uri "https://dl.min.io/server/minio/release/windows-amd64/minio.exe" -OutFile "minio.exe" | |
Invoke-WebRequest -Uri "https://dl.minio.io/client/mc/release/windows-amd64/mc.exe" -OutFile "mc.exe" | |
Start-Process -WorkingDirectory $PSScriptRoot -FilePath "$($PSScriptRoot)\minio-service.exe" -ArgumentList "install" -NoNewWindow -PassThru -Wait | |
Write-Host "Installation done" | |
Get-Service -Name minio | Start-Service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment