在 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 的版本 達到終止支援 或 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

沒有適用于 Alpine 的安裝程式。There are no installers for Alpine. 您必須使用 安裝腳本 ,或遵循 手動安裝 指示。You must either use the install script or follow the manual install instructions.

下表列出目前支援的 .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 版本不支援 Alpine 或 .net 版本。A ❌ indicates that the version of Alpine or .NET isn't supported on that Alpine release.
  • 當版本的 Alpine 和 .NET 版本都✔️時,支援該作業系統和 .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 (Advanced Package Tool) 作為套件管理員。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 版本不支援 Debian 或 .net 版本。A ❌ indicates that the version of Debian or .NET isn't supported on that Debian release.
  • 當版本的 Debian 和 .NET 版本都✔️時,支援該作業系統和 .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 版本不支援 Fedora 或 .net 版本。A ❌ indicates that the version of Fedora or .NET isn't supported on that Fedora release.
  • 當版本的 Fedora 和 .NET 版本都✔️時,支援該作業系統和 .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 版本不支援 rhel 或 .net 的版本。A ❌ indicates that the version of RHEL or .NET isn't supported on that RHEL release.
  • 當版本的 RHEL 和 .NET 版本都✔️時,支援該作業系統和 .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 版本不支援 sles 或 .net 的版本。A ❌ indicates that the version of SLES or .NET isn't supported on that SLES release.
  • 當 SLES 和某個版本的 .NET 都✔️時,支援該作業系統和 .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 (Advanced Package Tool) 作為套件管理員。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 版本不支援 ubuntu 或 .net 版本。A ❌ indicates that the version of Ubuntu or .NET isn't supported on that Ubuntu release.
  • 當 Ubuntu 版本和 .NET 版本都✔️時,支援該作業系統和 .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