Offline installation steps of Azure PowerShell for Linux
Closed this issue · 8 comments
Currently this documentation only has online install steps for Linux with Install-Module cmdlet.
As GitHub releases have .tar.gz package with Installmodule.PS1 in it, it seems to better to have offline installation steps as well.
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
- ID: 99a17d7e-7bb3-bc99-d53e-279ed00ce825
- Version Independent ID: 201a4e7b-e592-dc29-aec5-9e39c4809e87
- Content: Install Azure PowerShell on Linux
- Content Source: docs-conceptual/azps-10.3.0/install-azps-linux.md
- Service: azure-powershell
- GitHub Login: @mikefrobbins
- Microsoft Alias: mirobb
@thiruma0203
I've delegated this to @mikefrobbins, a content author, to review and share their valuable insights.
@thiruma0203 I've added this suggestion as an idea for a future enhancement to our documentation.
Any solution on this? looking for a way to install azurepowerhell in Redhat 7.9 version offline where internet is not enabled.
@thiruma0203 and @vivuu1989, the steps to install the Az PowerShell module offline via the tar archive are:
These instructions work cross-platform on Windows, Linux, and macOS:
- Install PowerShell version 7.2 or higher
- Download the tar archive of the Az module from the Azure PowerShell source repo releases page.
- Copy the file to the offline system.
- Unblock the file if on Windows:
Unblock-File -Path <file-path>
- Unarchive the tar file:
tar zxf <tar-file-location> -C <destination-path>
- Run
.<destination-path>/InstallModule.ps1
from PowerShell to install the Az module from the extracted files.
6. InstallModule.ps1
Didnt Work. (Redhat version 7.9, pwsh installed version 7.2.18)
getting the below error
./InstallModule.ps1: line 1: syntax error near unexpected token newline' '/InstallModule.ps1: line 1:
<#
removed the comment session as well, but again throwing the error
./InstallModule.ps1: line 3: $'.\r': command not found
./InstallModule.ps1: line 17: $'\r': command not found
./InstallModule.ps1: line 18: syntax error near unexpected token $']\r'' '/InstallModule.ps1: line 18:
[cmdletbinding()]
- InstallModule.ps1
Didnt Work. (Redhat version 7.9, pwsh installed version 7.2.18)
getting the below error
./InstallModule.ps1: line 1: syntax error near unexpected token
newline' '/InstallModule.ps1: line 1:
<#removed the comment session as well, but again throwing the error
./InstallModule.ps1: line 3:
$'.\r': command not found ./InstallModule.ps1: line 17: $ '\r': command not found ./InstallModule.ps1: line 18: syntax error near unexpected token$']\r'' '/InstallModule.ps1: line 18:
[cmdletbinding()]
You've launched PowerShell via pwsh
, correct? I receive the same error when running ./InstallModule.ps1
from Bash.
- InstallModule.ps1
Didnt Work. (Redhat version 7.9, pwsh installed version 7.2.18)
getting the below error
./InstallModule.ps1: line 1: syntax error near unexpected tokennewline' '/InstallModule.ps1: line 1:
<#
removed the comment session as well, but again throwing the error
./InstallModule.ps1: line 3: ′.\r′:commandnotfound./InstallModule.ps1:line17:'\r': command not found ./InstallModule.ps1: line 18: syntax error near unexpected token$']\r'' '/InstallModule.ps1: line 18:
[cmdletbinding()]You've launched PowerShell via
pwsh
, correct? I receive the same error when running./InstallModule.ps1
from Bash.
Yes, I followed the instruction which you shared above and installed powershell in redhat machine using command
sudo yum install https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/powershell-7.4.1-1.rh.x86_64.rpm
So the offline installation is not possible in Linux ?