Alpine Linux에 PowerShell 설치

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

참고 항목

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

설치 단계

Alpine에 설치하려면 먼저 릴리스 페이지에서 tar.gz 패키지를 다운로드합니다. 패키지의 URL은 설치하려는 PowerShell 버전에 따라 달라집니다.

  • PowerShell 7.4.2 - https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/powershell-7.4.2-linux-musl-x64.tar.gz
  • PowerShell 7.3.12 - https://github.com/PowerShell/PowerShell/releases/download/v7.3.12/powershell-7.3.12-linux-alpine-x64.tar.gz
  • PowerShell 7.2.19 - https://github.com/PowerShell/PowerShell/releases/download/v7.2.19/powershell-7.2.19-linux-alpine-x64.tar.gz

그런 다음 터미널에서 다음 셸 명령을 실행하여 PowerShell 7.3을 설치합니다.

# install the requirements
sudo apk add --no-cache \
    ca-certificates \
    less \
    ncurses-terminfo-base \
    krb5-libs \
    libgcc \
    libintl \
    libssl1.1 \
    libstdc++ \
    tzdata \
    userspace-rcu \
    zlib \
    icu-libs \
    curl

sudo apk -X https://dl-cdn.alpinelinux.org/alpine/edge/main add --no-cache \
    lttng-ust

# Download the powershell '.tar.gz' archive
curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/powershell-7.4.2-linux-musl-x64.tar.gz -o /tmp/powershell.tar.gz

# Create the target folder where powershell will be placed
sudo mkdir -p /opt/microsoft/powershell/7

# Expand powershell to the target folder
sudo tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7

# Set execute permissions
sudo chmod +x /opt/microsoft/powershell/7/pwsh

# Create the symbolic link that points to pwsh
sudo ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh

# Start PowerShell
pwsh

PowerShell 제거

sudo rm -rf /usr/bin/pwsh /opt/microsoft/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의 호스트별 구성을 준수하므로 기본 호스트별 프로필은 동일한 위치에 존재합니다 Microsoft.PowerShell_profile.ps1 .

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

지원되는 버전

다음 표에는 지원되는 PowerShell 릴리스 및 해당 릴리스가 지원되는 Alpine 버전이 나와 있습니다. 이러한 버전은 PowerShell 지원 종료 버전 또는 Alpine 지원 종료 버전까지 지원됩니다.

  • 아이콘은 지원됨 OS 또는 PowerShell의 버전이 계속 지원됨을 나타냅니다.
  • 아이콘은 지원 중단 해당 버전의 OS에서 PowerShell 버전이 더 이상 지원되지 않음을 나타냅니다.
  • 아이콘은 테스트 중 해당 OS에서 PowerShell 테스트를 완료하지 않았음을 나타냅니다.
  • 아이콘은 지원되지 않음 OS 또는 PowerShell의 버전이 지원되지 않음을 나타냅니다.
  • OS 버전과 PowerShell 버전 모두 아이콘이 있는 지원됨 경우 해당 조합이 지원됩니다.
Alpine 7.2(LTS 이전) 7.3 7.4(LTS-current)
지원됨 3.18 지원되지 않음 지원되지 않음 지원되지 않음
지원됨 3.17 테스트 중 테스트 중 테스트 중
지원됨 3.16 테스트 중 테스트 중 테스트 중
지원 중단 3.15 테스트 중 테스트 중 테스트 중
지원 중단 3.14 지원 중단 지원 중단 지원 중단

PowerShell은 다음 프로세서 아키텍처에 대해 Alpine에서 지원됩니다.

Alpine 7.2(LTS-current) 7.3 7.4(LTS-current)
지원되는 모든 버전 X64 X64 X64

PowerShell은 Arm 프로세서를 사용하여 Alpine에서 테스트되지 않았습니다.

설치 지원

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