文章目录
- linux 安装powershell
- refereces
- Ubuntu/Debian install powershell7+
- 检查当前发行版
- 运行安装脚本
- verify installation
- 安装/更新权限问题
- windows 安装(更新)powershell权限问题
linux 安装powershell
refereces
- Install PowerShell on Linux - PowerShell | Microsoft Docs
- Alpine
- CentOS
- Debian
- Fedora
Ubuntu/Debian install powershell7+
- Installation via direct download
- Installation on Debian 11 via Package Repository
- Installation on Debian 10 via Package Repository
- Installation on Debian 9 via Package Repository
检查当前发行版
-
cat /etc/issue
LSB Version: core-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic
Ubuntu 18.04.6 LTS \n \l
运行安装脚本
# Install system components
sudo apt update && sudo apt install -y curl gnupg apt-transport-https
# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
# Register the Microsoft Product feed
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list'
# Install PowerShell
sudo apt update && sudo apt install -y powershell
# Start PowerShell
pwsh
verify installation
-
cat /etc/shells|grep powershell
# cxxu @ cxxuAli in ~ [11:04:44]
$ cat /etc/shells
# /etc/shells: valid login shells
/bin/sh
/bin/bash
/bin/rbash
/bin/dash
/bin/zsh
/usr/bin/zsh
/usr/bin/pwsh
/opt/microsoft/powershell/7/pwsh
安装/更新权限问题
windows 安装(更新)powershell权限问题
- 如果powershell安装在D盘的某个目录(比如
D:\Program Files\PowerShell\7
有时候会出现权限不足问题 - 可以打开以管理员的方式打开powershell,进入到powershell安装包目录
- 命令行运行安装程序
- 安装程序运行到提示关闭所有powershell窗口时,关闭powershell窗口,等待安装程序结束任务