I am trying to follow the official website to use the following command on Powershell to install influxdb:
wget https://dl.influxdata.com/influxdb/releases/influxdb-1.8.10_windows_amd64.zip -UseBasicParsing -OutFile influxdb-1.8.10_windows_amd64.zip
Expand-Archive .\influxdb-1.8.10_windows_amd64.zip -DestinationPath 'C:\Program Files\InfluxData\influxdb\'
But I get the following error:
New-Item : Access to the path 'influxdb' is denied.
At
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:318
char:32
+ ... eatedItem = New-Item -Path $DestinationPath -ItemType Directory -Conf ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (C:\Program Files\InfluxData\influxdb\:String) [New-Item], Unauthorize
dAccessException
+ FullyQualifiedErrorId : CreateDirectoryUnauthorizedAccessError,Microsoft.PowerShell.Commands.NewItemCommand
May I know why and how I can fix this problem? Thank you
The problem is the Expand-Archive
command. It attempts to extract the downloaded archive to a subfolder in C:\Program Files
, but your user account does not have write permissions to this folder (which is by design).
The easiest way to work around this would be to run the command from an elevated PowerShell session (open PowerShell with "Run as Admin").