日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux 安装 powershell

發布時間:2023/12/4 linux 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux 安装 powershell 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

linux 安裝 powershell

Intro

powershell 已經推出了一個 Powershell Core, 版本號對應 Powershell 6.x,可以跨平臺,支持 Linux 和 mac. 這使得對于熟練使用 Powershell 進行開發運維的一些開發者來說無疑是個福音。

PowerShell 和 PowerShell Core

那Windows PowerShell與PowerShell Core 6.0又有什么區別呢,主要幾個區別如下:

  • Windows PowerShell是基于.NET Framework的,所以它也只能在Windows中使用。 PowerShell Core 6.0發布時,Windows PowerShell 最新的版本在5.*,但PowerShell Core 6.0 可不是Windows PowerShell的升級版本。

  • PowerShell Core 6.0因為它的跨平臺,自然不僅可以在 Windows 上運行也可以在其它平臺如macOS與Linux上運行,因為它是基于.NET Core基礎之上的。

  • Windows PowerShell在 Windows 中的執行文件為powershell.exe,而PowerShell Core 6.0在Windows中的執行文件是pwsh.exe,在 macOS 和 Linux 中的執行文件是 pwsh

PowerShell Core 平臺支持情況

PowerShell 現在官方支持 macOS 和 Linux,包括:

  • Windows 7、8.1 和 10

  • Windows Server 2008 R2、2012 R2、2016

  • Windows Server 半年頻道

  • Ubuntu 14.04、16.04 和 17.04

  • Debian 8.7+ 和 9

  • CentOS 7

  • Red Hat Enterprise Linux 7

  • OpenSUSE 42.2

  • Fedora 25、26

  • macOS 10.12+

我們社區也為以下平臺提供包,但是它們不受正式支持:

  • Arch Linux

  • Kali Linux

  • AppImage(可在多個 Linux 平臺上運行)

我們還對以下平臺提供試驗版本(不受支持):

  • ARM32/ARM64 上的 Windows

  • Raspbian (Stretch)

在 Linux上安裝 PowerShell

這里以 Centos 為例,介紹如何安裝 PowerShell,其他 Linux 系統可以參考這里的文檔

這里有兩種方式可以安裝

  • 注冊微軟的鏡像源(推薦)

  • # Register the Microsoft RedHat repository

  • curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo


  • # Install PowerShell

  • sudo yum install -y powershell

    • 直接下載文件安裝

  • sudo yum install https://github.com/PowerShell/PowerShell/releases/download/v6.1.0/powershell-6.1.0-1.rhel.7.x86_64.rpm

  • 安裝完成之后可以直接執行 pwsh 就可以進入 powershell 了,如果可以正常進入則證明安裝成功了。

    卸載

  • sudo yum remove powershell

  • Reference

    • https://docs.microsoft.com/zh-cn/powershell/scripting/whats-new/what-s-new-in-powershell-core-60?view=powershell-6

    • https://docs.microsoft.com/zh-cn/powershell/scripting/setup/installing-powershell-core-on-linux?view=powershell-6#centos-7

    Contact

    Contact me: weihanli@outlook.com


    總結

    以上是生活随笔為你收集整理的linux 安装 powershell的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。