linux:powershell

差分

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

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
次のリビジョン両方とも次のリビジョン
linux:powershell [2020/02/15 11:41] – [PowerShell] ともやんlinux:powershell [2020/08/30 19:12] – [Fedora - dnf] ともやん
行 1: 行 1:
-====== PowerShell ======+<html> 
 +  <style> 
 +    #result pre, #mincode pre { 
 +      overflow: hidden; 
 +      font-size: 10px; 
 +    } 
 +    #result_long pre { 
 +      height: 250px; 
 +      overflow: scroll; 
 +      overflow-x: hidden; 
 +      font-size: 10px; 
 +    } 
 +    #mintbl table { 
 +      font-size: 12px; 
 +    } 
 +    .dokuwiki .plugin_wrap table { 
 +      width: auto; 
 +    } 
 +    #logo { 
 +      background-color: white; 
 +      padding: 10px; 
 +      width: fit-content; 
 +    } 
 +    #logo p { 
 +      margin: 0; 
 +    } 
 +  </style> 
 +</html> 
 +====== PowerShell(Linux) ======
 [[windows:powershell|PowerShell - Windows]]\\ [[windows:powershell|PowerShell - Windows]]\\
 \\ \\
行 5: 行 33:
 ソースコード: [[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: 行 39:
 [[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> 
 +</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 31 (Thirty One) 
 +</code> 
 +</WRAP> 
 + 
 +2020/08/30 現在 [[https://packages.microsoft.com/fedora/31/prod/|]] に PowerShell が存在していないので Fedora 30 の packages-microsoft-com-prod ([[https://packages.microsoft.com/fedora/30/prod/|]]) からインストールを行う。\\ 
 +<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   195  100   195    0        454      0 --:--:-- --:--:-- --:--:--   453 
 +[packages-microsoft-com-prod] 
 +name=packages-microsoft-com-prod 
 +baseurl=https://packages.microsoft.com/fedora/30/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> 
 +<code powershell> 
 +packages-microsoft-com-prod                                                             608 kB/s | 760 kB     00:01 
 +メタデータの期限切れの最終確認: 0:00:01 時間前の 2020年08月30日 17時51分53秒 に実施しました。 
 +依存関係が解決しました。 
 +============================================================================================================ 
 + Package             Architecture      Version               Repository                                Size 
 +============================================================================================================ 
 +インストール: 
 + powershell          x86_64            7.0.3-1.rhel.7        packages-microsoft-com-prod               55 M 
 + 
 +トランザクションの概要 
 +============================================================================================================ 
 +インストール  パッケージ 
 + 
 +ダウンロードサイズの合計: 55 M 
 +インストール済みのサイズ: 151 M 
 +これでよろしいですか? [y/N]: y 
 +パッケージのダウンロード: 
 +powershell-7.0.3-1.rhel.7.x86_64.rpm                                            9.5 MB/s |  55 MB     00:05 
 +------------------------------------------------------------------------------------------------------------ 
 +合計                                                                             9.5 MB/s |  55 MB     00:05 
 +トランザクションの確認を実行中 
 +トランザクションの確認に成功しました。 
 +トランザクションのテストを実行中 
 +トランザクションのテストに成功しました。 
 +トランザクションを実行中 
 +  準備             :                                                                                      1/1 
 +  インストール中   : powershell-7.0.3-1.rhel.7.x86_64                                                      1/1 
 +  scriptletの実行中: powershell-7.0.3-1.rhel.7.x86_64                                                     1/1 
 +  検証             : powershell-7.0.3-1.rhel.7.x86_64                                                     1/1 
 + 
 +インストール済み: 
 +  powershell-7.0.3-1.rhel.7.x86_64 
 + 
 +完了しました!
 </code> </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.0.0-rc.2
行 42: 行 178:
 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: 行 213:
 WSManStackVersion              3.0 WSManStackVersion              3.0
 </code> </code>
 +</WRAP>
  
  • linux/powershell.txt
  • 最終更新: 2023/03/30 21:17
  • by ともやん