linux:powershell

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
次のリビジョン両方とも次のリビジョン
linux:powershell [2020/02/15 11:41] – [PowerShell] ともやんlinux:powershell [2021/07/06 15:06] ともやん
行 1: 行 1:
-====== PowerShell ======+~~CLOSETOC~~ 
 +====== PowerShell(Linux) ======
 [[windows:powershell|PowerShell - Windows]]\\ [[windows:powershell|PowerShell - Windows]]\\
 \\ \\
行 5: 行 6:
 ソースコード: [[https://github.com/PowerShell/PowerShell|GitHub - PowerShell/PowerShell: PowerShell for every system!]]\\ ソースコード: [[https://github.com/PowerShell/PowerShell|GitHub - PowerShell/PowerShell: PowerShell for every system!]]\\
 \\ \\
-{{:linux:powershell_v7.0.0-rc.2_on_fedora_31.png?600|PowerShell 7 on Fedora 31}}\\+{{linux:powershell_v7.0.0-rc.2_on_fedora_31.png?470|PowerShell 7 on Fedora 31}}\\
  
 ===== インストール ===== ===== インストール =====
行 11: 行 12:
 [[https://aka.ms/pscore6|]]\\ [[https://aka.ms/pscore6|]]\\
 [[https://aka.ms/pscore6-docs|]]\\ [[https://aka.ms/pscore6-docs|]]\\
-[[https://github.com/PowerShell/PowerShell/releases/tag/v7.0.0-rc.1|Releases · PowerShell/PowerShell - Release Candidate 1]]\\ +[[https://aka.ms/powershell|]]\\ 
-[[https://github.com/PowerShell/PowerShell/releases/tag/v7.0.0-rc.2|Releases · PowerShell/PowerShell - Release Candidate 2]]\\ + 
-\\ +==== Fedora - dnf ==== 
-==== Fedora 31 ====+[[https://docs.microsoft.com/ja-jp/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7#fedora|Fedora への PowerShell のインストール - PowerShell | Microsoft Docs]]\\ 
 +<WRAP prewrap 100% #mincode>
 <code> <code>
-sudo dnf install https://github.com/PowerShell/PowerShell/releases/download/v7.0.0-rc.2/powershell-preview-7.0.0_rc.2-1.centos.8.x86_64.rpm+# Register the Microsoft signature key 
 +sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc 
 + 
 +# Register the Microsoft RedHat repository 
 +curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo 
 + 
 +# Update the list of products 
 +sudo dnf check-update 
 + 
 +# Install a system component 
 +sudo dnf install compat-openssl10 
 + 
 +# Install PowerShell 
 +sudo dnf install -y powershell 
 + 
 +# Start PowerShell 
 +pwsh
 </code> </code>
 +</WRAP>
 +
 +<WRAP prewrap 100%>
 +<code>
 +$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
 +</code>
 +</WRAP>
 +
 +<WRAP prewrap 100%>
 +<code>
 +$ cat /etc/redhat-release
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% #result>
 +<code powershell>
 +Fedora release 34 (Thirty Four)
 +</code>
 +</WRAP>
 +
 +packages-microsoft-com-prod ([[https://packages.microsoft.com/rhel/7/prod/|]]) に最新の PowerShell が配置されるように変わりました。(2021/07/06 確認)\\
 +<del>2020/08/30 現在 [[https://packages.microsoft.com/fedora/31/prod/|]] に PowerShell が存在していないので Fedora 30 の packages-microsoft-com-prod ([[https://packages.microsoft.com/fedora/30/prod/|]]) からインストールを行う。</del>\\
 +<WRAP prewrap 100%>
 +<code>
 +$ curl https://packages.microsoft.com/config/fedora/30/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% #result>
 +<code powershell>
 +  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
 +                                 Dload  Upload   Total   Spent    Left  Speed
 +100   193  100   193    0        720      0 --:--:-- --:--:-- --:--:--   717
 +[packages-microsoft-com-prod]
 +name=packages-microsoft-com-prod
 +baseurl=https://packages.microsoft.com/rhel/7/prod/
 +enabled=1
 +gpgcheck=1
 +gpgkey=https://packages.microsoft.com/keys/microsoft.asc
 +</code>
 +</WRAP>
 +
 +<WRAP prewrap 100%>
 +<code>
 +$ sudo dnf install powershell
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% result_long>
 +<code powershell>
 +メタデータの期限切れの最終確認: 0:01:37 時間前の 2021年07月06日 15時02分32秒 に実施しました。
 +依存関係が解決しました。
 +===============================================================================================
 + パッケージ       Arch         バージョン              リポジトリー                      サイズ
 +===============================================================================================
 +インストール:
 + powershell       x86_64       7.1.3-1.rhel.7          packages-microsoft-com-prod        65 M
 +
 +トランザクションの概要
 +===============================================================================================
 +インストール  1 パッケージ
 +
 +合計サイズ: 65 M
 +インストール後のサイズ: 170 M
 +これでよろしいですか? [y/N]: y
 +パッケージのダウンロード:
 +[SKIPPED] powershell-7.1.3-1.rhel.7.x86_64.rpm: Already downloaded                            
 +-----------------------------------------------------------------------------------------------
 +合計                                                           6.3 GB/s |  65 MB     00:00     
 +トランザクションの確認を実行中
 +トランザクションの確認に成功しました。
 +トランザクションのテストを実行中
 +トランザクションのテストに成功しました。
 +トランザクションを実行中
 +  準備             :                                                                       1/
 +  インストール中   : powershell-7.1.3-1.rhel.7.x86_64                                      1/1 
 +  scriptletの実行中: powershell-7.1.3-1.rhel.7.x86_64                                      1/1 
 +  検証             : powershell-7.1.3-1.rhel.7.x86_64                                      1/1 
 +
 +インストール済み:
 +  powershell-7.1.3-1.rhel.7.x86_64                                                             
 +
 +完了しました!
 +</code>
 +</WRAP>
  
 ===== PowerShell の実行 ===== ===== PowerShell の実行 =====
 +<WRAP prewrap 100%>
 <code> <code>
 $ pwsh $ pwsh
 </code> </code>
 +</WRAP>
 +
 **Release Candidate** 版の場合\\ **Release Candidate** 版の場合\\
 +<WRAP prewrap 100%>
 <code> <code>
 $ pwsh-preview $ pwsh-preview
 </code> </code>
 +</WRAP>
  
 ===== PowerShell のバージョン ===== ===== PowerShell のバージョン =====
 +<WRAP prewrap 100%>
 +<code powershell>
 +$ Get-Host
 +</code>
 +</WRAP>
 +<WRAP prewrap 100% result>
 <code powershell> <code powershell>
-PS > Get-Host 
- 
 Name             : ConsoleHost Name             : ConsoleHost
-Version          : 7.0.0-rc.2 +Version          : 7.1.3 
-InstanceId       : 546f330c-e929-4775-8001-43778f6ce1c7+InstanceId       : c1e30af9-69bb-4101-a11b-298ff0f195dd
 UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
 CurrentCulture   : ja-JP CurrentCulture   : ja-JP
行 42: 行 151:
 IsRunspacePushed : False IsRunspacePushed : False
 Runspace         : System.Management.Automation.Runspaces.LocalRunspace Runspace         : System.Management.Automation.Runspaces.LocalRunspace
 +</code>
 +</WRAP>
  
- +<WRAP prewrap 100%> 
-PS > Get-Host | Select-Object Version +<code powershell> 
 +Get-Host | Select-Object Version 
 +</code> 
 +</WRAP> 
 +<WRAP prewrap 100% #result> 
 +<code powershell>
 Version Version
 ------- -------
 7.0.0-rc.2 7.0.0-rc.2
 +</code>
 +</WRAP>
  
-PS > $PSVersiontable +<WRAP prewrap 100%> 
 +<code powershell> 
 +$PSVersiontable 
 +</code> 
 +</WRAP> 
 +<WRAP prewrap 100% #result> 
 +<code powershell>
 Name                           Value Name                           Value
 ----                           ----- ----                           -----
行 64: 行 186:
 WSManStackVersion              3.0 WSManStackVersion              3.0
 </code> </code>
 +</WRAP>
  
  • linux/powershell.txt
  • 最終更新: 2023/03/30 21:17
  • by ともやん