在 Linux 上安装 .NETInstall .NET on Linux

.NET 在不同的 Linux 发行版上可用。.NET is available on different Linux distributions. 大多数 Linux 平台和发行版每年都有一个主要版本,并提供用于安装 .NET 的包管理器。Most Linux platforms and distributions have a major release each year, and most provide a package manager that is used to install .NET. 本文介绍当前支持的版本以及使用的包管理器。This article describes what is currently supported and which package manager is used.

本文其余部分详细介绍了 .NET 支持的每个主要 Linux 发行版。The rest of this article is a breakdown of each major Linux distribution that .NET supports. 所有 .NET 版本在 .NET Core 版本达到支持终止日期或 Linux 发行版达到生命周期之前仍受支持。All .NET releases remain supported until either the version of .NET reaches end-of-support or the Linux distribution reaches end-of-life.

为了实现最佳兼容性,请选择长期支持版本 (LTS)。For the best compatibility, choose a long-term release (LTS) version.

不支持的版本Unsupported releases

以下 .NET 版本 ❌ 不再受到支持。The following versions of .NET are ❌ no longer supported. 这些版本的下载仍保持发布状态:The downloads for these still remain published:

  • 3.03.0
  • 2.22.2
  • 2.02.0

以下部分未详细介绍这些不受支持的版本,如果你尝试安装它们,则实际数据可能有所不同。These unsupported versions aren't detailed in the sections below and your mileage may vary if you try to install them.

AlpineAlpine

下表列出了当前支持的 .NET 版本以及支持它们的 Alpine 版本。The following table is a list of currently supported .NET releases and the versions of Alpine they're supported on. 这些版本在 .NET 到达支持终止日期Alpine 的版本到达有效期之前仍受支持。These versions remain supported until either the version of .NET reaches end-of-support or the version of Alpine reaches end-of-life.

  • ✔️ 指示 Alpine 或 .NET 版本仍受支持。A ✔️ indicates that the version of Alpine or .NET is still supported.
  • ❌ 指示 Alpine 或 .NET 版本在该 Alpine 发行版本上不受支持。A ❌ indicates that the version of Alpine or .NET isn't supported on that Alpine release.
  • 当 Alpine 版本和 .NET 版本都有 ✔️ 时,将支持该 OS 和 .NET 组合。When both a version of Alpine and a version of .NET have ✔️, that OS and .NET combination is supported.
AlpineAlpine .NET Core 2.1.NET Core 2.1 .NET Core 3.1.NET Core 3.1 .NET 5.0.NET 5.0
✔️ 3.12✔️ 3.12 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0
✔️ 3.11✔️ 3.11 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0
✔️ 3.10✔️ 3.10 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ❌ 5.0❌ 5.0
3.93.9 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ❌ 5.0❌ 5.0
3.83.8 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ❌ 5.0❌ 5.0

有关详细信息,请参阅在 Alpine 上安装 .NETFor more information, see Install .NET on Alpine.

CentOSCentOS

CentOS 7 使用 Yum 作为包管理器,CentOS 8 使用 DNF。CentOS 7 uses Yum as a package manager and CentOS 8 uses DNF.

下表列出了 CentOS 7 和 CentOS 8 上当前受支持的 .NET 版本。The following table is a list of currently supported .NET releases on both CentOS 7 and CentOS 8. 这些版本在 .NET 版本达到支持终止日期或 CentOS 版本不再受支持之前仍受支持。These versions remain supported until either the version of .NET reaches end-of-support or the version of CentOS is no longer supported.

CentOSCentOS .NET Core 2.1.NET Core 2.1 .NET Core 3.1.NET Core 3.1 .NET 5.0.NET 5.0
✔️ 8✔️ 8 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0
✔️ 7✔️ 7 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0

有关详细信息,请参阅在 CentOS 上安装 .NETFor more information, see Install .NET on CentOS.

DebianDebian

Debian 将 APT(高级包工具)用作包管理器。Debian uses APT (Advanced Package Tool) as a package manager.

下表列出了当前支持的 .NET 版本以及支持它们的 Debian 版本。The following table is a list of currently supported .NET releases and the versions of Debian they're supported on. 这些版本在 .NET 版本达到支持终止日期Debian 的版本达到生命周期之前仍受支持。These versions remain supported until either the version of .NET reaches end-of-support or the version of Debian reaches end-of-life.

  • ✔️ 指示 Debian 或 .NET 版本仍受支持。A ✔️ indicates that the version of Debian or .NET is still supported.
  • ❌ 指示 Debian 或 .NET 版本在该 Debian 版本上不受支持。A ❌ indicates that the version of Debian or .NET isn't supported on that Debian release.
  • 当 Debian 版本和 .NET 版本都有 ✔️ 时,将支持该 OS 和 .NET 组合。When both a version of Debian and a version of .NET have ✔️, that OS and .NET combination is supported.
DebianDebian .NET Core 2.1.NET Core 2.1 .NET Core 3.1.NET Core 3.1 .NET 5.0.NET 5.0
✔️ 10✔️ 10 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0
✔️ 9✔️ 9 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0
88 ✔️ 2.1✔️ 2.1 ❌ 3.1❌ 3.1 ❌ 5.0❌ 5.0

有关详细信息,请参阅在 Debian 上安装 .NETFor more information, see Install .NET on Debian.

FedoraFedora

Fedora 将 DNF 用作其包管理器。Fedora uses DNF as its package manager.

下表列出了当前支持的 .NET 版本以及支持它们的 Fedora 版本。The following table is a list of currently supported .NET releases and the versions of Fedora they're supported on. 这些版本在 .NET 版本达到支持终止日期Fedora 版本达到生命周期之前仍受支持。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 版本仍受支持。A ✔️ indicates that the version of Fedora or .NET is still supported.
  • ❌ 指示 Fedora 或 .NET 版本在该 Fedora 版本上不受支持。A ❌ indicates that the version of Fedora or .NET isn't supported on that Fedora release.
  • 当 Fedora 版本和 .NET 版本都有 ✔️ 时,将支持该 OS 和 .NET 组合。When both a version of Fedora and a version of .NET have ✔️, that OS and .NET combination is supported.
FedoraFedora .NET Core 2.1.NET Core 2.1 .NET Core 3.1.NET Core 3.1 .NET 5.0.NET 5.0
✔️ 33✔️ 33 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0
✔️ 32✔️ 32 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0
3131 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ❌ 5.0❌ 5.0
3030 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ❌ 5.0❌ 5.0
2929 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ❌ 5.0❌ 5.0
2828 ✔️ 2.1✔️ 2.1 ❌ 3.1❌ 3.1 ❌ 5.0❌ 5.0
2727 ✔️ 2.1✔️ 2.1 ❌ 3.1❌ 3.1 ❌ 5.0❌ 5.0

有关详细信息,请参阅在 Fedora 上安装 .NETFor more information, see Install .NET on Fedora.

openSUSEopenSUSE

openSUSE 将 zypper 用作包管理器。openSUSE uses zypper as the package manager.

下表列出了 openSUSE 15 上当前受支持的 .NET 版本。The following table is a list of currently supported .NET releases on openSUSE 15. 这些版本在 .NET 版本达到支持终止日期或 openSUSE 版本不再受支持之前仍受支持。These versions remain supported until either the version of .NET reaches end-of-support or the version of openSUSE is no longer supported.

openSUSEopenSUSE .NET Core 2.1.NET Core 2.1 .NET Core 3.1.NET Core 3.1 .NET 5.0.NET 5.0
✔️ 15✔️ 15 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0

有关详细信息,请参阅在 openSUSE 上安装 .NETFor more information, see Install .NET on openSUSE.

Red HatRed Hat

Red Hat Enterprise Linux (RHEL) 将 yum (RHEL 7) 和 DNF (RHEL 8) 用作包管理器。Red Hat Enterprise Linux (RHEL) uses yum (RHEL 7) and DNF (RHEL 8) as the package manager.

下表列出了 RHEL 7 和 RHEL 8 上当前受支持的 .NET 版本。The following table is a list of currently supported .NET releases on both RHEL 7 and RHEL 8. 这些版本在 .NET 达到支持终止日期或 RHEL 版本不再受到支持之前仍受支持。These versions remain supported until either the version of .NET reaches end-of-support or the version of RHEL is no longer supported.

  • ✔️ 指示 RHEL 或 .NET 版本仍受支持。A ✔️ indicates that the version of RHEL or .NET is still supported.
  • ❌ 指示 RHEL 或 .NET 版本在该 RHEL 版本上不受支持。A ❌ indicates that the version of RHEL or .NET isn't supported on that RHEL release.
  • 当 RHEL 版本和 .NET 版本都有 ✔️ 时,将支持该 OS 和 .NET 组合。When both a version of RHEL and a version of .NET have ✔️, that OS and .NET combination is supported.
RHELRHEL .NET Core 2.1.NET Core 2.1 .NET Core 3.1.NET Core 3.1 .NET 5.0.NET 5.0
✔️ 8✔️ 8 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0
✔️ 7✔️ 7 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0

有关详细信息,请参阅在 RHEL 上安装 .NETFor more information, see Install .NET on RHEL.

SLESSLES

SLES 将 zypper 用作包管理器。SLES uses zypper as the package manager.

下表列出了 SLES 12 SP2 和 SLES 15 上当前受支持的 .NET 版本。The following table is a list of currently supported .NET releases on both SLES 12 SP2 and SLES 15. 这些版本在 .NET 达到支持终止日期或 SLES 版本不再受到支持之前仍受支持。These versions remain supported until either the version of .NET reaches end-of-support or the version of SLES is no longer supported.

  • ✔️ 指示 SLES 或 .NET 版本仍受支持。A ✔️ indicates that the version of SLES or .NET is still supported.
  • ❌ 指示 SLES 或 .NET 版本在该 SLES 版本上不受支持。A ❌ indicates that the version of SLES or .NET isn't supported on that SLES release.
  • 当 SLES 版本和 .NET 版本都有 ✔️ 时,将支持该 OS 和 .NET 组合。When both a version of SLES and a version of .NET have ✔️, that OS and .NET combination is supported.
SLESSLES .NET Core 2.1.NET Core 2.1 .NET Core 3.1.NET Core 3.1 .NET 5.0.NET 5.0
✔️ 15✔️ 15 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0
✔️ 12 SP2✔️ 12 SP2 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0

有关详细信息,请参阅在 SLES 上安装 .NETFor more information, see Install .NET on SLES.

UbuntuUbuntu

Ubuntu 将 APT(高级包工具)用作包管理器。Ubuntu uses APT (Advanced Package Tool) as a package manager.

下表表示 Ubuntu 和 .NET 的支持状态。The following table represents the support status of Ubuntu and .NET.

  • ✔️ 指示 Ubuntu 或 .NET 版本仍受支持。A ✔️ indicates that the version of Ubuntu or .NET is still supported.
  • ❌ 指示 Ubuntu 或 .NET 版本在该 Ubuntu 版本上不受支持。A ❌ indicates that the version of Ubuntu or .NET isn't supported on that Ubuntu release.
  • 当 Ubuntu 版本和 .NET 版本都有 ✔️ 时,将支持该 OS 和 .NET 组合。When both a version of Ubuntu and a version of .NET have ✔️, that OS and .NET combination is supported.
UbuntuUbuntu .NET Core 2.1.NET Core 2.1 .NET Core 3.1.NET Core 3.1 .NET 5.0.NET 5.0
✔️ 20.10✔️ 20.10 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0
✔️ 20.04 (LTS)✔️ 20.04 (LTS) ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0
19.1019.10 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0
19.0419.04 ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ❌ 5.0❌ 5.0
18.1018.10 ✔️ 2.1✔️ 2.1 ❌ 3.1❌ 3.1 ❌ 5.0❌ 5.0
✔️ 18.04 (LTS)✔️ 18.04 (LTS) ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0
17.1017.10 ✔️ 2.1✔️ 2.1 ❌ 3.1❌ 3.1 ❌ 5.0❌ 5.0
17.0417.04 ✔️ 2.1✔️ 2.1 ❌ 3.1❌ 3.1 ❌ 5.0❌ 5.0
16.1016.10 ❌ 2.1❌ 2.1 ❌ 3.1❌ 3.1 ❌ 5.0❌ 5.0
✔️ 16.04 (LTS)✔️ 16.04 (LTS) ✔️ 2.1✔️ 2.1 ✔️ 3.1✔️ 3.1 ✔️ 5.0✔️ 5.0

有关详细信息,请参阅在 Ubuntu 上安装 .NETFor more information, see Install .NET on Ubuntu.

后续步骤Next steps