LoginSignup
3
2

More than 1 year has passed since last update.

LinuxにPowershellインストール方法について

Last updated at Posted at 2021-06-07

はじめに

Powershell をインストールするには、以下の各ディストロの手順を参照してください。

RHEL8

curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
sudo dnf install -y powershell
pwsh

RHEL7

curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
sudo dnf install -y powershell
pwsh

Ubuntu 20.04

wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo add-apt-repository universe
sudo apt-get install -y powershell
pwsh

Ubuntu 18.04

wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo add-apt-repository universe
sudo apt-get install -y powershell
pwsh

Azure Powershellモジュール

次に、PowershellからAzure Powershellモジュールをインストールします:

PS > Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force

Docker

または、Docker が使用されている場合は、Azure Powershell のコンテナーを使用することもできます:

docker run -it mcr.microsoft.com/azure-powershell pwsh

おわりに

Azure Powershellをインストールした後、Connect-AzAccount -UseDeviceAuthenticationでログインしすると、Azureのコマンドを使うことができます。例えばGet-AzVMを使って見てください。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2