Debian에 PowerShell 설치

모든 패키지는 GitHub 릴리스 페이지에서 사용할 수 있습니다 . 설치하기 전에 아래 지원 되는 버전 목록을 확인합니다. 패키지가 설치된 후 터미널에서 pwsh를 실행합니다. 미리 보기 릴리스를 설치한 경우 pwsh-lts를 실행합니다.

참고 항목

PowerShell 7.4는 이전 버전의 PowerShell 7을 제거하는 현재 위치 업그레이드입니다. PowerShell의 미리 보기 버전은 다른 버전의 PowerShell과 함께 설치할 수 있습니다. PowerShell 7.4를 이전 버전과 나란히 실행해야 하는 경우 이진 보관 메서드를 사용하여 이전 버전을 다시 설치합니다.

Debian은 패키지 관리자로 APT(고급 패키지 도구)를 사용합니다.

패키지 리포지토리를 통해 Debian 10 또는 11에 설치

Microsoft는 Linux 시스템을 위한 다양한 소프트웨어 제품을 빌드 및 지원하며 Linux 패키징 클라이언트(apt, dnf, yum 등)를 통해 사용할 수 있도록 합니다. 이러한 Linux 소프트웨어 패키지는 PMC라고도 하는 Microsoft 제품의 Linux 패키지 리포지토리에서 호스트됩니다https://packages.microsoft.com.

PMC에서 PowerShell을 설치하는 것이 기본 설치 방법입니다.

참고 항목

이 스크립트는 지원되는 버전의 Debian에서만 작동합니다.

###################################
# Prerequisites

# Update the list of packages
sudo apt-get update

# Install pre-requisite packages.
sudo apt-get install -y wget

# Get the version of Debian
source /etc/os-release

# Download the Microsoft repository GPG keys
wget -q https://packages.microsoft.com/config/debian/$VERSION_ID/packages-microsoft-prod.deb

# Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb

# Delete the Microsoft repository GPG keys file
rm packages-microsoft-prod.deb

# Update the list of packages after we added packages.microsoft.com
sudo apt-get update

###################################
# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh

직접 다운로드를 통해 설치

PowerShell 7.2에는 설치를 간소화하는 범용 패키지가 도입되었습니다. 릴리스 페이지에서 Debian 컴퓨터로 유니버설 패키지를 다운로드합니다.

현재 버전의 링크는 다음과 같습니다.

  • 지원되는 버전의 Debian에 대한 PowerShell 7.4(LTS) 유니버설 패키지
    • https://github.com/PowerShell/PowerShell/releases/download/v7.4.5/powershell_7.4.5-1.deb_amd64.deb
  • 지원되는 버전의 Debian용 PowerShell 7.2(LTS) 유니버설 패키지
    • https://github.com/PowerShell/PowerShell/releases/download/v7.2.23/powershell_7.2.23-1.deb_amd64.deb
  • 지원되는 버전의 Debian용 PowerShell 7.5 미리 보기 유니버설 패키지
    • https://github.com/PowerShell/PowerShell/releases/download/v7.5.0-preview.3/powershell-preview_7.5.0-preview.3-1.deb_amd64.deb

다음 셸 스크립트는 PowerShell의 현재 릴리스를 다운로드하고 설치합니다. 설치하려는 PowerShell 버전을 다운로드하도록 URL을 변경할 수 있습니다.

###################################
# Prerequisites

# Update the list of packages
sudo apt-get update

# Install pre-requisite packages.
sudo apt-get install -y wget

# Download the PowerShell package file
wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.5/powershell_7.4.5-1.deb_amd64.deb

###################################
# Install the PowerShell package
sudo dpkg -i powershell_7.4.5-1.deb_amd64.deb

# Resolve missing dependencies and finish the install (if necessary)
sudo apt-get install -f

# Delete the downloaded package file
rm powershell_7.4.5-1.deb_amd64.deb

# Start PowerShell
pwsh

PowerShell 제거

sudo apt-get remove powershell

PowerShell 경로

  • $PSHOME/opt/microsoft/powershell/7/인 경우
  • 프로필 스크립트는 다음 위치에 저장됩니다.
    • AllUsersAllHosts - $PSHOME/profile.ps1
    • AllUsersCurrentHost - $PSHOME/Microsoft.PowerShell_profile.ps1
    • CurrentUserAllHosts - ~/.config/powershell/profile.ps1
    • CurrentUserCurrentHost - ~/.config/powershell/Microsoft.PowerShell_profile.ps1
  • 모듈은 다음 위치에 저장됩니다.
    • 사용자 모듈 - ~/.local/share/powershell/Modules
    • 공유 모듈 - /usr/local/share/powershell/Modules
    • 기본 모듈 - $PSHOME/Modules
  • PSReadLine 기록은 다음에서 기록됩니다. ~/.local/share/powershell/PSReadLine/ConsoleHost_history.txt

PowerShell은 Linux의 XDG 기본 디렉터리 사양을 따릅니다.

지원되는 버전

Microsoft는 PowerShell이 지원 종료에 도달하거나 Debian 버전이 수명이 다할 때까지 PowerShell을 지원합니다.

설치 패키지 파일(.deb)도 .에서 https://packages.microsoft.com/사용할 수 있습니다.

x64용 PowerShell 7.2, PowerShell 7.4 및 PowerShell 7.5-preview를 포함하는 Docker 이미지는 다음 버전의 Debian에 대한 Microsoft 아티팩트 레지스트리 사용할 수 있습니다.

  • Debian 12(Bookworm) - OS 지원은 2026-06-10에 종료됩니다.
  • Debian 11(Bullseye) - OS 지원은 2024-07-31에 종료됩니다.

Important

Docker 이미지는 OS 배포자에서 제공하는 OS(공식 운영 체제) 이미지에서 빌드됩니다. 이러한 이미지에는 최신 보안 업데이트가 없을 수 있습니다. 최신 보안 업데이트가 적용되도록 OS 패키지를 최신 버전으로 업데이트하는 것이 좋습니다.

설치 지원

Microsoft는 이 문서의 설치 방법을 지원합니다. 다른 타사 원본에서 사용할 수 있는 다른 설치 방법이 있을 수 있습니다. 관련 도구 및 방법이 유효하더라도 Microsoft에서는 해당 방법을 지원할 수 없습니다.