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 系统可以参考这里的文档

这里有两种方式可以安装

  • 注册微软的镜像源(推荐)

  1. # Register the Microsoft RedHat repository

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

  3. # Install PowerShell

  4. sudo yum install -y powershell

  • 直接下载文件安装

  1. 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 了,如果可以正常进入则证明安装成功了。

卸载

  1. 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相关推荐

  1. Fedora Linux安装 PowerShell

    导读 本文介绍如何在主机上和在 Podman 或其他容器内安装 PowerShell. PowerShell(也可写作 pwsh)是一个功能强大的开源命令行工具,它是面向对象的,由微软开发和维护.它的 ...

  2. power linux 安装系统,在Linux系统中安装/使用PowerShell Core 6.0

    在微软爱上 Linux 之后,PowerShell 这个原本只是 Windows 才能使用的组件,于 2016 年 8 月 18 日开源并且成为跨平台软件,登陆了 Linux 和 macOS. Pow ...

  3. power linux 安装系统,powershell 安装服务器

    如何在 Windows Server 2008 上安装 Exchange 2007 SP1 先决条件 ${textbanner3.replace("\n","" ...

  4. linux版_巧用linux版powershell,管理linux下的docker

    owershell,docker,cli,命令,docker ps,docker image 第一章 在linux中搭建docker环境 目的: 在任意版本的linux(物理机,虚拟机,节点机)中,安 ...

  5. 巧用linux版powershell,管理linux下的docker

    owershell,docker,cli,命令,docker ps,docker image 第一章 在linux中搭建docker环境 目的: 在任意版本的linux(物理机,虚拟机,节点机)中,安 ...

  6. wsl 重启_WSL(Windows Subsystem for Linux) 安装教程

    WSL(Windows Subsystem for Linux) 安装教程: --START: 1.以管理员身份运行powershell ,输入下面的代码,等待提示完成后,重启系统: Enable-W ...

  7. 如何在Windows 10上安装PowerShell 7

    Microsoft 微软 Microsoft announced PowerShell 7.0 on March 4, 2020. It's the latest major update to Po ...

  8. 【ubuntu(Linux)安装Vs code并配置c++编译及cmake多文件编译】

    目录标题 VS code配置c++编译环境 1. Linux系统安装 2. 在Ubuntu中安装VS code 2.1. 首先下载对应系统的VS code安装包 2.2. 安装VS code 3. 在 ...

  9. 实用的Linux 安装 zip unzip

    Linux 安装 zip unzip 1.apt-get 安装 apt-get install zip 2.yum 安装 yum install -y unzip zip 命令实例 1.把/home目 ...

最新文章

  1. 如何让Ubuntu系统支持WebP图片格式
  2. [云炬创业管理笔记]第三章打造优秀创业团队讨论4
  3. BufferedInputStream 缓冲区原理解析
  4. tomcat源码分析_Tomcat源码分析(一)--Tomcat的初始化
  5. java类的命名规范_浅谈Java中的命名规范
  6. OpenCV与图像处理学习一——图像基础知识、读入、显示、保存图像、灰度转化、通道分离与合并
  7. python字典中的键是什么_在python字典中作为键的对象
  8. linux防止文件和目录被意外删除或修改
  9. DuiLib教程--认识她
  10. pyserial安装失败
  11. 壳聚糖/纳米金水凝胶/纳米木质素/掺杂二硫化钼/微米级Ag2O2掺杂壳聚糖水凝胶的制备研究
  12. MAALA3.9_初等矩阵和等价 (Elementary Matrices and Equivalence)
  13. 是你需要的前端编码风格吗?
  14. 关于在JS中引入JS文件的JQ方法
  15. aardio - 虚表库全新升级,支持图片系列专题
  16. Canvas--文字
  17. 什么错误是计算机检查不出来的,如何在Windows 10中修复计算机检查异常BSOD | MOS86...
  18. UEFI+GPT引导基础
  19. 腾讯99公益日-券券松鼠❤
  20. Tensorflow MobileNet移动端迁移学习指南

热门文章

  1. 禁用磁盘检查_如何在Windows上禁用“磁盘空间不足”警告
  2. 云计算基础知识:CPU虚拟化
  3. Android6 0权限机制(一):介绍
  4. HealthKit有名无实,疑点重重
  5. com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input
  6. 数据结构基础:栈(Stack)
  7. 加密、解密以及Openssl建立私有CA
  8. 【POJ】【最小生成树】1789 Truck History
  9. 对症下药教你清除电脑中的木马
  10. .NET6之MiniAPI(十五):跨域CORS(下)