Install the .NET SDK or the .NET Runtime on Fedora

.NET is supported on Fedora and this article describes how to install .NET on Fedora. When a Fedora version falls out of support, .NET is no longer supported with that version.

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 and ASP.NET Core runtimes.

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 is already installed.

For more information on installing .NET without a package manager, see one of the following articles:

Supported distributions

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

Fedora .NET
40 8.0, 6.0
39 8.0, 6.0

The following versions of .NET are ❌ no longer supported:

  • .NET 7
  • .NET 5
  • .NET Core 3.1
  • .NET Core 3.0
  • .NET Core 2.2
  • .NET Core 2.1
  • .NET Core 2.0

Install .NET 8

Install the SDK

The .NET SDK allows you to develop apps with .NET. If you install the .NET SDK, you don't need to install the corresponding runtime. To install the .NET SDK, run the following command:

sudo dnf install dotnet-sdk-8.0

To learn how to use the .NET CLI, see .NET CLI overview.

Install the runtime

The ASP.NET Core Runtime allows you to run apps that were made with .NET that didn't provide the runtime. The following command installs the ASP.NET Core Runtime, which is the most compatible runtime for .NET. In your terminal, run the following command:

sudo dnf install aspnetcore-runtime-8.0

As an alternative to the ASP.NET Core Runtime, you can install the .NET Runtime, which doesn't include ASP.NET Core support: replace aspnetcore-runtime-8.0 in the previous command with dotnet-runtime-8.0:

sudo dnf install dotnet-runtime-8.0

To learn how to use the .NET CLI, see .NET CLI overview.

Install .NET 6

Install the SDK

The .NET SDK allows you to develop apps with .NET. If you install the .NET SDK, you don't need to install the corresponding runtime. To install the .NET SDK, run the following command:

sudo dnf install dotnet-sdk-6.0

To learn how to use the .NET CLI, see .NET CLI overview.

Install the runtime

The ASP.NET Core Runtime allows you to run apps that were made with .NET that didn't provide the runtime. The following command installs the ASP.NET Core Runtime, which is the most compatible runtime for .NET. In your terminal, run the following command:

sudo dnf install aspnetcore-runtime-6.0

As an alternative to the ASP.NET Core Runtime, you can install the .NET Runtime, which doesn't include ASP.NET Core support: replace aspnetcore-runtime-6.0 in the previous command with dotnet-runtime-6.0:

sudo dnf install dotnet-runtime-6.0

To learn how to use the .NET CLI, see .NET CLI overview.

Install preview versions

Preview and release candidate versions of .NET aren't available in package repositories. You can install previews and release candidates of .NET in one of the following ways:

Remove preview versions

When using a package manager to manage your installation of .NET, you may run into a conflict if you've previously installed a preview release. The package manager may interpret the non-preview release as an earlier version of .NET. To install the non-preview release, first uninstall the preview versions. For more information about uninstalling .NET, see How to remove the .NET Runtime and SDK.

Dependencies

When you install with a package manager, these libraries are installed for you. But, if you manually install .NET or you publish a self-contained app, you'll need to make sure these libraries are installed:

  • krb5-libs
  • libicu
  • openssl-libs
  • zlib

If the target runtime environment's OpenSSL version is 1.1 or newer, you'll need to install compat-openssl10.

Dependencies can be installed with the yum install command. The following snippet demonstrates installing the libicu library:

sudo yum install libicu

For more information about the dependencies, see Self-contained Linux apps.

If the .NET app uses the System.Drawing.Common assembly, libgdiplus will also need to be installed. Because System.Drawing.Common is no longer supported on Linux, this only works on .NET 6 and requires setting the System.Drawing.EnableUnixSupport runtime configuration switch.

You can install a recent version of libgdiplus by adding the Mono repository to your system.

Install on older distributions

Older versions of Fedora don't contain .NET in the default package repositories. You can install .NET with the dotnet-install.sh script, or use Microsoft's repository to install .NET:

  1. First, add the Microsoft signing key to your list of trusted keys.

    sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
    
  2. Next, add the Microsoft package repository. The source of the repository is based on your version of Fedora.

    Fedora Version Package repository
    36 https://packages.microsoft.com/config/fedora/36/prod.repo
    35 https://packages.microsoft.com/config/fedora/35/prod.repo
    34 https://packages.microsoft.com/config/fedora/34/prod.repo
    33 https://packages.microsoft.com/config/fedora/33/prod.repo
    32 https://packages.microsoft.com/config/fedora/32/prod.repo
    31 https://packages.microsoft.com/config/fedora/31/prod.repo
    30 https://packages.microsoft.com/config/fedora/30/prod.repo
    29 https://packages.microsoft.com/config/fedora/29/prod.repo
    28 https://packages.microsoft.com/config/fedora/28/prod.repo
    27 https://packages.microsoft.com/config/fedora/27/prod.repo
    sudo wget -O /etc/yum.repos.d/microsoft-prod.repo https://packages.microsoft.com/config/fedora/31/prod.repo
    
  3. Use the sudo dnf install command to install a .NET package.

How to install other versions

All versions of .NET are available for download at https://dotnet.microsoft.com/download/dotnet, but require manual installation. You can try to use the package manager to install a different version of .NET. However, the requested version might not be available.

The packages added to package manager feeds are named in a hackable format, for example: {product}-{type}-{version}.

  • product
    The type of .NET product to install. Valid options are:

    • dotnet
    • aspnetcore
  • type
    Chooses the SDK or the runtime. Valid options are:

    • sdk (only available for the dotnet product)
    • runtime
  • version
    The version of the SDK or runtime to install. Valid options are any released version, such as:

    • 8.0
    • 6.0
    • 3.1
    • 2.1

    It's possible the SDK/runtime you're trying to download isn't available for your Linux distribution. For a list of supported distributions, see Install .NET on Linux.

Examples

  • Install the ASP.NET Core 8.0 runtime: aspnetcore-runtime-8.0
  • Install the .NET Core 2.1 runtime: dotnet-runtime-2.1
  • Install the .NET 5 SDK: dotnet-sdk-5.0
  • Install the .NET Core 3.1 SDK: dotnet-sdk-3.1

Note

Some package might not be available on your Linux distribution.

Package missing

If the package-version combination doesn't work, it's not available. For example, there isn't an ASP.NET Core SDK. The SDK components for ASP.NET Core are included with the .NET SDK. The value aspnetcore-sdk-8.0 is incorrect and should be dotnet-sdk-8.0. For a list of Linux distributions supported by .NET, see .NET dependencies and requirements.

Troubleshoot the package manager

This section provides information on common errors you may get while using the package manager to install .NET or .NET Core.

Unable to find package

For more information on installing .NET without a package manager, see one of the following articles:

Failed to fetch

While installing the .NET package, you may see an error similar to signature verification failed for file 'repomd.xml' from repository 'packages-microsoft-com-prod'. Generally speaking, this error means that the package feed for .NET is being upgraded with newer package versions, and that you should try again later. During an upgrade, the package feed should not be unavailable for more than 2 hours. If you continually receive this error for more than 2 hours, please file an issue at https://github.com/dotnet/core/issues.

For more information about solving these problems, see Troubleshoot fxr, libhostfxr.so, and FrameworkList.xml errors.

Next steps