Closed englianhu closed 2 years ago
englianhu@Scibrokes:~$ wget https://github.com/PowerShell/PowerShell/releases/download/v7.3.0-preview.7/powershell-preview_7.3.0-preview.7-1.deb_amd64.deb
--2022-09-30 21:36:01-- https://github.com/PowerShell/PowerShell/releases/download/v7.3.0-preview.7/powershell-preview_7.3.0-preview.7-1.deb_amd64.deb
正在解析主机 github.com (github.com)... 140.82.113.3
正在连接 github.com (github.com)|140.82.113.3|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:https://objects.githubusercontent.com/github-production-release-asset-2e65be/49609581/ff3ed211-9c96-4d8f-9127-eb1452da6367?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220930%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220930T133602Z&X-Amz-Expires=300&X-Amz-Signature=c475f0f5c76337ddb657892786b5ddb2eb1c7bf0e450eeb6939bac9c16bca66f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=49609581&response-content-disposition=attachment%3B%20filename%3Dpowershell-preview_7.3.0-preview.7-1.deb_amd64.deb&response-content-type=application%2Foctet-stream [跟随至新的 URL]
--2022-09-30 21:36:02-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/49609581/ff3ed211-9c96-4d8f-9127-eb1452da6367?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220930%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220930T133602Z&X-Amz-Expires=300&X-Amz-Signature=c475f0f5c76337ddb657892786b5ddb2eb1c7bf0e450eeb6939bac9c16bca66f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=49609581&response-content-disposition=attachment%3B%20filename%3Dpowershell-preview_7.3.0-preview.7-1.deb_amd64.deb&response-content-type=application%2Foctet-stream
正在解析主机 objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.109.133, ...
正在连接 objects.githubusercontent.com (objects.githubusercontent.com)|185.199.111.133|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:47428934 (45M) [application/octet-stream]
正在保存至: “powershell-preview_7.3.0-preview.7-1.deb_amd64.deb”
powershell-preview_7. 100%[=========================>] 45.23M 5.41MB/s 用时 7.7s
2022-09-30 21:36:11 (5.91 MB/s) - 已保存 “powershell-preview_7.3.0-preview.7-1.deb_amd64.deb” [47428934/47428934])
englianhu@Scibrokes:~$ sudo gdebi ./*.deb && sudo rm -rf ./*.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading state information... Done
PowerShell is an automation and configuration management platform.
It consists of a cross-platform command-line shell and associated scripting language.
您是否想安装这个软件包?[y/N]:Y
/usr/bin/gdebi:113: FutureWarning: Possible nested set at position 1
c = findall("[[(](\S+)/\S+[])]", msg)[0].lower()
正在选中未选择的软件包 powershell-preview。
(正在读取数据库 ... 系统当前共安装有 574569 个文件和目录。)
准备解压 .../powershell-preview_7.3.0-preview.7-1.deb_amd64.deb ...
正在解压 powershell-preview (7.3.0-preview.7-1.deb) ...
正在设置 powershell-preview (7.3.0-preview.7-1.deb) ...
正在处理用于 man-db (2.8.5-2) 的触发器 ...
englianhu@Scibrokes:~$ pwsh
bash: pwsh:未找到命令
也可通过软件库下载安装。
## 解压缩到指定的路径
sudo tar -C /usr/lib -xzvf PowerShell-7.3.0-preview.7.tar.gz
sudo rm -rf PowerShell-7.3.0-preview.7.tar.gz
sudo mv /usr/lib/PowerShell-7.3.0-preview.7/ /usr/lib/PowerShell
sudo chmod 777 -R /usr/lib/PowerShell
cd /usr/lib/PowerShell
...
...
# 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
englianhu@Scibrokes:~$ pwsh
PowerShell 7.2.6
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.
PS /home/englianhu> exit
englianhu@Scibrokes:~$ code --version
1.71.2
74b1f979648cc44d385a2286793c226e611f59e7
x64
Originally posted by @englianhu in https://github.com/microsoft/vscode/issues/159194#issuecomment-1227459674