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

.NET is supported on Red Hat Enterprise Linux (RHEL). This article describes how to install .NET on RHEL.

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.

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

Register your Red Hat subscription

To install .NET from Red Hat on RHEL, you first need to register using the Red Hat Subscription Manager. If this hasn't been done on your system, or if you're unsure, see the Red Hat Product Documentation for .NET.

Supported distributions

The following table is a list of currently supported .NET releases on both RHEL 7 and RHEL 8. These versions remain supported until either the version of .NET reaches end-of-support or the version of RHEL is no longer supported.

  • A ✔️ indicates that the version of RHEL or .NET is still supported.
  • A ❌ indicates that the version of RHEL or .NET isn't supported on that RHEL release.
  • When both a version of RHEL and a version of .NET have ✔️, that OS and .NET combination is supported.
RHEL .NET Core 2.1 .NET Core 3.1 .NET 5.0
✔️ 8 ✔️ 2.1 ✔️ 3.1 ✔️ 5.0
✔️ 7 ✔️ 2.1 ✔️ 3.1 ✔️ 5.0

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

  • 3.0
  • 2.2
  • 2.0

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.

RHEL 8 ✔️

.NET is included in the AppStream repositories for RHEL 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 commands:

sudo dnf install dotnet-sdk-5.0

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 commands install the ASP.NET Core Runtime, which is the most compatible runtime for .NET. In your terminal, run the following commands:

sudo dnf install aspnetcore-runtime-5.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-5.0 in the previous command with dotnet-runtime-5.0:

sudo dnf install dotnet-runtime-5.0

RHEL 7 ✔️ .NET 5.0

The following command installs the scl-utils package:

sudo yum install scl-utils

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 .NET SDK, run the following commands:

subscription-manager repos --enable=rhel-7-server-dotnet-rpms
yum install rh-dotnet50 -y
scl enable rh-dotnet50 bash

Red Hat does not recommend permanently enabling rh-dotnet50 because it may affect other programs. If you want to enable rh-dotnet permanently, add the following line to your ~/.bashrc file.

source scl_source enable rh-dotnet50

Install the runtime

The .NET Runtime allows you to run apps that were made with .NET that didn't include the runtime. The commands below install the ASP.NET Core Runtime, which is the most compatible runtime for .NET Core. In your terminal, run the following commands.

subscription-manager repos --enable=rhel-7-server-dotnet-rpms
yum install rh-dotnet50-aspnetcore-runtime-5.0 -y
scl enable rh-dotnet50 bash

Red Hat does not recommend permanently enabling rh-dotnet50 because it may affect other programs. If you want to enable rh-dotnet50 permanently, add the following line to your ~/.bashrc file.

source scl_source enable rh-dotnet50

As an alternative to the ASP.NET Core Runtime, you can install the .NET Runtime that doesn't include ASP.NET Core support: replace rh-dotnet50-aspnetcore-runtime-5.0 in the commands above with rh-dotnet50-dotnet-runtime-5.0.

RHEL 7 ✔️ .NET Core 3.1

Before you install .NET, run the following commands to add the Microsoft package signing key to your list of trusted keys and add the Microsoft package repository. Open a terminal and run the following commands:

The following command installs the scl-utils package:

sudo yum install scl-utils

Install the SDK

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

subscription-manager repos --enable=rhel-7-server-dotnet-rpms
yum install rh-dotnet31 -y
scl enable rh-dotnet31 bash

Red Hat does not recommend permanently enabling rh-dotnet31 because it may affect other programs. For example, rh-dotnet31 includes a version of libcurl that differs from the base RHEL version. This may lead to issues in programs that do not expect a different version of libcurl. If you want to enable rh-dotnet permanently, add the following line to your ~/.bashrc file.

source scl_source enable rh-dotnet31

Install the runtime

The .NET Core Runtime allows you to run apps that were made with .NET Core that didn't include the runtime. The commands below install the ASP.NET Core Runtime, which is the most compatible runtime for .NET Core. In your terminal, run the following commands.

subscription-manager repos --enable=rhel-7-server-dotnet-rpms
yum install rh-dotnet31-aspnetcore-runtime-3.1 -y
scl enable rh-dotnet31 bash

Red Hat does not recommend permanently enabling rh-dotnet31 because it may affect other programs. For example, rh-dotnet31 includes a version of libcurl that differs from the base RHEL version. This may lead to issues in programs that do not expect a different version of libcurl. If you want to enable rh-dotnet31 permanently, add the following line to your ~/.bashrc file.

source scl_source enable rh-dotnet31

As an alternative to the ASP.NET Core Runtime, you can install the .NET Core Runtime that doesn't include ASP.NET Core support: replace rh-dotnet31-aspnetcore-runtime-3.1 in the commands above with rh-dotnet31-dotnet-runtime-3.1.

Dependencies

When you install with a package manager, these libraries are installed for you. But, if you manually install .NET Core 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.

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

For .NET Core apps that use the System.Drawing.Common assembly, you'll also need the following dependency:

How to install other versions

Consult the Red Hat documentation for .NET on the steps required to install other releases of .NET.

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.

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

Next steps