These are step-by-step instructions as they seems to be scattered all over the internet. I will start with a completely clean, stock Alpine distro.
Install
Dependencies
Alpine does not have .NET 6 installers or sudo, so you have to install dependencies as admin first:
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 itself does not need admin privileges to install. First, download install script:
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
give it exec permission
isb:~$ chmod +x dotnet-install.sh
and install the latest runtime:
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.
At this point .net is fully installed.
Add to path
Alpine is using ash shell, so you need to create .profile
in your home folder and add the following:
export DOTNET_ROOT=$(pwd)/.dotnet
export PATH=$PATH:$DOTNET_ROOT
Now reload the shell and you're done.
Short way
- Run as su
su
apk add bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib
exit
- Run as user
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
Top comments (0)