AlmaLinux 9.0にPowerShellをインストールする

環境
OSバージョンの確認
# cat /etc/redhat-release
AlmaLinux release 9.0 (Emerald Puma)

PowerShellのインストール手順
1.システムパッケージを更新します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo dnf upgrade --refresh
# sudo dnf upgrade --refresh
# sudo dnf upgrade --refresh

2.GPGキーをインポートします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
# sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
# sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

PowerShellリポジトリをインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo rpm -Uvh https://packages.microsoft.com/config/centos/8/packages-microsoft-prod.rpm
# sudo rpm -Uvh https://packages.microsoft.com/config/centos/8/packages-microsoft-prod.rpm
# sudo rpm -Uvh https://packages.microsoft.com/config/centos/8/packages-microsoft-prod.rpm

3.PowerShellをインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo dnf install powershell -y
# sudo dnf install powershell -y
# sudo dnf install powershell -y

4.PowerShellをアクティブします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# pwsh
PowerShell 7.2.4
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.
PS /root>
# pwsh PowerShell 7.2.4 Copyright (c) Microsoft Corporation. https://aka.ms/powershell Type 'help' to get help. PS /root>
# pwsh
PowerShell 7.2.4
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /root>

コマンド動作確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
PS /root> Get-Host
Name : ConsoleHost
Version : 7.2.4
InstanceId : da19b958-8f72-4028-aada-f7e8d0866ba2
UI : System.Management.Automation.Internal.Host.InternalHostUserI
nterface
CurrentCulture : ja-JP
CurrentUICulture : ja-JP
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
PS /root> Get-Host Name : ConsoleHost Version : 7.2.4 InstanceId : da19b958-8f72-4028-aada-f7e8d0866ba2 UI : System.Management.Automation.Internal.Host.InternalHostUserI nterface CurrentCulture : ja-JP CurrentUICulture : ja-JP PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy DebuggerEnabled : True IsRunspacePushed : False Runspace : System.Management.Automation.Runspaces.LocalRunspace
PS /root> Get-Host

Name             : ConsoleHost
Version          : 7.2.4
InstanceId       : da19b958-8f72-4028-aada-f7e8d0866ba2
UI               : System.Management.Automation.Internal.Host.InternalHostUserI
                   nterface
CurrentCulture   : ja-JP
CurrentUICulture : ja-JP
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

 

AlmaLinux

Posted by arkgame