the best way to install powershell on Ubuntu

 

FROM chatGPT:

The best and most reliable way to install PowerShell on Ubuntu is by using the Microsoft-provided package repositories, which ensure you get the latest stable version maintained by Microsoft. Here's a clean, professional step-by-step for Ubuntu (20.04 or newer):


✅ Step-by-step: Installing PowerShell on Ubuntu

1. Update the system

sudo apt update && sudo apt upgrade -y

2. Install required dependencies

sudo apt install -y wget apt-transport-https software-properties-common

3. Import the Microsoft GPG key

wget -q https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb

4. Update your package list again

sudo apt update

5. Install PowerShell

sudo apt install -y powershell

6. Run PowerShell

pwsh

📌 Notes

  • pwsh is the executable name (short for PowerShell).

  • The official repo will keep it updated with apt upgrade.

  • If you use an older Ubuntu (like 18.04), substitute $(lsb_release -rs) with 18.04 explicitly.


Would you like instructions for setting up a portable version, using Snap, or building from source instead?

 

posted @ 2025-05-23 02:23  profesor  阅读(24)  评论(0)    收藏  举报