깨끗한 Alpine Linux에 .NET 6 런타임 설치

6490 단어 dotnetlinuxalpine
인터넷에 흩어져 있는 것처럼 보이는 단계별 지침입니다. 완전히 깨끗한 스톡 알파인 배포판부터 시작하겠습니다.

설치



종속성



Alpine에는 .NET 6 설치 프로그램 또는 sudo가 없으므로 먼저 관리자로 종속성을 설치해야 합니다.

isb:/home/alg# apk add bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
(1/13) Installing ncurses-terminfo-base (6.3_p20211120-r1)
(2/13) Installing ncurses-libs (6.3_p20211120-r1)
(3/13) Installing readline (8.1.1-r0)
(4/13) Installing bash (5.1.16-r0)
Executing bash-5.1.16-r0.post-install
(5/13) Installing libgcc (10.3.1_git20211027-r0)
(6/13) Installing libstdc++ (10.3.1_git20211027-r0)
(7/13) Installing icu-libs (69.1-r1)
(8/13) Installing krb5-conf (1.0-r2)
(9/13) Installing libcom_err (1.46.4-r0)
(10/13) Installing keyutils-libs (1.6.3-r0)
(11/13) Installing libverto (0.3.2-r0)
(12/13) Installing krb5-libs (1.19.3-r0)
(13/13) Installing libintl (0.21-r0)
Executing busybox-1.34.1-r3.trigger
OK: 49 MiB in 35 packages


.NET 6



.NET 6 자체는 설치에 관리자 권한이 필요하지 않습니다. 먼저 설치 스크립트를 다운로드합니다.

isb:~$ wget https://dot.net/v1/dotnet-install.sh
Connecting to dot.net (20.84.181.62:443)
Connecting to dotnet.microsoft.com (13.107.246.64:443)
saving to 'dotnet-install.sh'
dotnet-install.sh    100% |************************************************************************| 57823  0:00:00 ETA
'dotnet-install.sh' saved


실행 권한을 부여하십시오

isb:~$ chmod +x dotnet-install.sh


최신 런타임을 설치합니다.

isb:~$ ./dotnet-install.sh -c Current --runtime aspnetcore
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: wget extra options are unavailable for this environment
dotnet-install: Attempting to download using aka.ms link https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/6.0.9/aspnetcore-runtime-6.0.9-linux-musl-x64.tar.gz
dotnet-install: wget extra options are unavailable for this environment
Connecting to dotnetcli.azureedge.net (152.199.19.161:443)
saving to '/tmp/dotnet.XXXKEaFfa'
dotnet.XXXKEaFfa     100% |************************************************************************| 37.5M  0:00:00 ETA
'/tmp/dotnet.XXXKEaFfa' saved
dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/6.0.9/aspnetcore-runtime-6.0.9-linux-musl-x64.tar.gz
dotnet-install: Installed version is 6.0.9
dotnet-install: Adding to current process PATH: `/home/alg/.dotnet`. Note: This change will be visible only when sourcing script.
dotnet-install: Note that the script does not resolve dependencies during installation.
dotnet-install: To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
dotnet-install: Installation finished successfully.


이 시점에서 .net이 완전히 설치되었습니다.

경로에 추가



Alpine은 ash 셸을 사용하므로 홈 폴더에 .profile를 만들고 다음을 추가해야 합니다.

export DOTNET_ROOT=$(pwd)/.dotnet
export PATH=$PATH:$DOTNET_ROOT


이제 쉘을 다시 로드하면 완료됩니다.

짧은 길


  • su로 실행

  • su
    apk add bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib
    exit
    


  • 사용자로 실행

  • wget https://dot.net/v1/dotnet-install.sh
    chmod +x dotnet-install.sh
    ./dotnet-install.sh -c Current --runtime aspnetcore
    vi .profile
    # paste 2 lines:
    # export DOTNET_ROOT=$(pwd)/.dotnet
    # export PATH=$PATH:$DOTNET_ROOT
    source .profile
    

    좋은 웹페이지 즐겨찾기