# Install .NET Core SDK or .NET Core Runtime on Alpine

This article describes how to install .NET Core on Alpine. When a Alpine version falls out of support, .NET Core is no longer supported with that version. However, these instructions may help you to get .NET Core running on those versions, even though it isn't supported.

Install the SDK (which includes the runtime) if you want to develop .NET apps. Or, if you only need to run apps, install the runtime. If you're installing the runtime, we suggest you install the ASP.NET Core runtime as it includes both .NET Core and ASP.NET Core runtimes.

If you've already installed the SDK or runtime, use the dotnet --list-sdks and dotnet --list-runtimes commands to see which versions are installed. For more information, see How to check that .NET Core is already installed.

There are no installers for Alpine. You must either use the install script or follow the manual install instructions.

## Supported distributions

The following table is a list of currently supported .NET Core releases and the versions of Alpine they're supported on. These versions remain supported until either the version of .NET Core reaches end-of-support or the version of Alpine reaches end-of-life.

• A ✔️ indicates that the version of Alpine or .NET Core is still supported.
• A ❌ indicates that the version of Alpine or .NET Core isn't supported on that Alpine release.
• When both a version of Alpine and a version of .NET Core have ✔️, that OS and .NET combination are supported.
Alpine .NET Core 2.1 .NET Core 3.1 .NET 5 Preview
✔️ 3.12 ✔️ 2.1 ✔️ 3.1 ✔️ 5.0 Preview
✔️ 3.11 ✔️ 2.1 ✔️ 3.1 ✔️ 5.0 Preview
✔️ 3.10 ✔️ 2.1 ✔️ 3.1 ✔️ 5.0 Preview
✔️ 3.9 ✔️ 2.1 ✔️ 3.1 ✔️ 5.0 Preview
❌ 3.8 ✔️ 2.1 ❌ 3.1 ❌ 5.0 Preview

The following versions of .NET Core are no longer supported. The downloads for these still remain published:

• 3.0
• 2.2
• 2.0

## Dependencies

.NET Core on Alpine Linux requires the following dependencies installed:

• icu-libs
• krb5-libs
• libgcc
• libintl
• libssl1.1 (Alpine v3.9 or greater)
• libssl1.0 (Alpine v3.8 or lower)
• libstdc++
• zlib

## Scripted install

The dotnet-install scripts are used for automation and non-admin installs of the SDK and Runtime. You can download the script from https://dot.net/v1/dotnet-install.sh.

The script defaults to installing the latest SDK long term support (LTS) version, which is .NET Core 3.1. To install the current release, which may not be an (LTS) version, use the -c Current parameter.

./dotnet-install.sh -c Current


To install .NET Core Runtime instead of the SDK, use the --runtime parameter.

./dotnet-install.sh -c Current --runtime aspnetcore


You can install a specific version by altering the -c parameter to indicate the specific version. The following command installs .NET Core SDK 3.1.

./dotnet-install.sh -c 3.1


## Manual install

As an alternative to the package managers, you can download and manually install the SDK and runtime. Manual install is usually performed as part of continuous integration testing or on an unsupported Linux distribution. For a developer or user, it's generally better to use a package manager.

If you install .NET Core SDK, you don't need to install the corresponding runtime. First, download a binary release for either the SDK or the runtime from one of the following sites:

Next, extract the downloaded file and use the export command to set variables used by .NET Core and then ensure .NET Core is in PATH.

To extract the runtime and make the .NET Core CLI commands available at the terminal, first download a .NET Core binary release. Then, open a terminal and run the following commands from the directory where the file was saved. The archive file name may be different depending on what you downloaded.

Use the following command to extract the runtime:

mkdir -p "$HOME/dotnet" && tar zxf aspnetcore-runtime-3.1.0-linux-x64.tar.gz -C "$HOME/dotnet"
export DOTNET_ROOT=$HOME/dotnet export PATH=$PATH:$HOME/dotnet  Use the following command to extract the SDK: mkdir -p "$HOME/dotnet" && tar zxf dotnet-sdk-3.1.301-linux-x64.tar.gz -C "$HOME/dotnet" export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet


Tip

The preceding export commands only make the .NET Core CLI commands available for the terminal session in which it was run.

You can edit your shell profile to permanently add the commands. There are a number of different shells available for Linux and each has a different profile. For example:

• Bash Shell: ~/.bash_profile, ~/.bashrc
• Korn Shell: ~/.kshrc or .profile
• Z Shell: ~/.zshrc or .zprofile

Edit the appropriate source file for your shell and add :$HOME/dotnet to the end of the existing PATH statement. If no PATH statement is included, add a new line with export PATH=$PATH:$HOME/dotnet. Also, add export DOTNET_ROOT=$HOME/dotnet to the end of the file.

This approach lets you install different versions into separate locations and choose explicitly which one to use by which application.