Net core linux desktop

Install .NET on Linux

.NET is available on different Linux distributions. 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.

The rest of this article is a breakdown of each major Linux distribution that .NET supports. All .NET releases remain supported until either the version of .NET reaches end-of-support or the Linux distribution reaches end-of-life.

For the best compatibility, choose a long-term release (LTS) version.

Unsupported releases

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

These unsupported versions aren’t detailed in the sections below and your mileage may vary if you try to install them.

Manual installation

If you don’t want to use a package manager to install .NET on Linux, you can install .NET in one of the following ways:

Be sure to check the appropriate distribution page for more information about any required dependencies that may be missing when you do a manual installation.

Install preview versions

Preview and Release Candidate versions of .NET aren’t available in package managers. You can install previews and release candidates of .NET manually.

Alpine

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

  • A вњ”пёЏ indicates that the version of Alpine or .NET is still supported.
  • A вќЊ indicates that the version of Alpine or .NET isn’t supported on that Alpine release.
  • When both a version of Alpine and a version of .NET have вњ”пёЏ, that OS and .NET combination is supported.
Alpine .NET Core 2.1 .NET Core 3.1 .NET 5.0
вњ”пёЏ 3.13 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вњ”пёЏ 5.0
вњ”пёЏ 3.12 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вњ”пёЏ 5.0
вњ”пёЏ 3.11 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вњ”пёЏ 5.0
вњ”пёЏ 3.10 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вќЊ 5.0
вќЊ 3.9 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вќЊ 5.0
вќЊ 3.8 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вќЊ 5.0

CentOS

CentOS 7 uses Yum as a package manager and CentOS 8 uses DNF.

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

CentOS .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

Debian

Debian uses APT (Advanced Package Tool) as a package manager.

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

  • A вњ”пёЏ indicates that the version of Debian or .NET is still supported.
  • A вќЊ indicates that the version of Debian or .NET isn’t supported on that Debian release.
  • When both a version of Debian and a version of .NET have вњ”пёЏ, that OS and .NET combination is supported.
Debian .NET Core 2.1 .NET Core 3.1 .NET 5.0
вњ”пёЏ 11 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вњ”пёЏ 5.0
вњ”пёЏ 10 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вњ”пёЏ 5.0
вњ”пёЏ 9 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вњ”пёЏ 5.0
вќЊ 8 вњ”пёЏ 2.1 вќЊ 3.1 вќЊ 5.0

Fedora

Fedora uses DNF as its package manager.

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.

  • A вњ”пёЏ indicates that the version of Fedora or .NET is still supported.
  • A вќЊ indicates that the version of Fedora or .NET isn’t supported on that Fedora release.
  • When both a version of Fedora and a version of .NET have вњ”пёЏ, that OS and .NET combination is supported.
Fedora .NET Core 2.1 .NET Core 3.1 .NET 5.0
вњ”пёЏ 34 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вњ”пёЏ 5.0
вњ”пёЏ 33 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вњ”пёЏ 5.0
вњ”пёЏ 32 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вњ”пёЏ 5.0
вќЊ 31 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вќЊ 5.0
вќЊ 30 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вќЊ 5.0
вќЊ 29 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вќЊ 5.0
вќЊ 28 вњ”пёЏ 2.1 вќЊ 3.1 вќЊ 5.0
вќЊ 27 вњ”пёЏ 2.1 вќЊ 3.1 вќЊ 5.0

openSUSE

openSUSE uses zypper as the package manager.

The following table is a list of currently supported .NET releases on openSUSE 15. These versions remain supported until either the version of .NET reaches end-of-support or the version of openSUSE is no longer supported.

openSUSE .NET Core 2.1 .NET Core 3.1 .NET 5.0
вњ”пёЏ 15 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вњ”пёЏ 5.0

Red Hat

Red Hat Enterprise Linux (RHEL) uses yum (RHEL 7) and DNF (RHEL 8) as the package manager.

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

For more information, see Install .NET on RHEL.

SLES uses zypper as the package manager.

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

  • A вњ”пёЏ indicates that the version of SLES or .NET is still supported.
  • A вќЊ indicates that the version of SLES or .NET isn’t supported on that SLES release.
  • When both a version of SLES and a version of .NET have вњ”пёЏ, that OS and .NET combination is supported.
SLES .NET Core 2.1 .NET Core 3.1 .NET 5.0
вњ”пёЏ 15 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вњ”пёЏ 5.0
вњ”пёЏ 12 SP2 вњ”пёЏ 2.1 вњ”пёЏ 3.1 вњ”пёЏ 5.0

For more information, see Install .NET on SLES.

Ubuntu

Ubuntu uses APT (Advanced Package Tool) as a package manager.

The following table represents the support status of Ubuntu and .NET.

Источник

Install the .NET SDK or the .NET Runtime manually

.NET is supported on Linux and this article describes how to install .NET on Linux using the install script or by extracting the binaries. For a list of distributions that support the built-in package manager, see Install .NET on Linux.

You can also install .NET with snap. For more information, see Install the .NET SDK or the .NET Runtime with Snap.

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.

.NET releases

The following table lists the .NET (and .NET Core) releases:

вњ”пёЏ Supported вќЊ Unsupported
5.0 3.0
3.1 (LTS) 2.2
2.1 (LTS) 2.0
1.1
1.0

For more information about the life cycle of .NET releases, see .NET Core and .NET 5 Support Policy.

Dependencies

It’s possible that when you install .NET, specific dependencies may not be installed, such as when manually installing. The following list details Linux distributions that are supported by Microsoft and have dependencies you may need to install. Check the distribution page for more information:

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

RPM dependencies

If your distribution wasn’t previously listed, and is RPM-based, you may need the following dependencies:

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

DEB dependencies

If your distribution wasn’t previously listed, and is debian-based, you may need the following dependencies:

Common dependencies

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

You can install a recent version of libgdiplus by adding the Mono repository to your system. For more information, see https://www.mono-project.com/download/stable/.

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.

![IMPORTANT] Bash is required to run the script.

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.

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

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

Manual install

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

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

Next, extract the downloaded file and use the export command to set DOTNET_ROOT to the extracted folder’s location and then ensure .NET is in PATH. This should make the .NET CLI commands available at the terminal.

Alternatively, after downloading the .NET binary, the following commands may be run from the directory where the file is saved to extract the runtime. This will also make the .NET CLI commands available at the terminal and set the required environment variables. Remember to change the DOTNET_FILE value to the name of the downloaded binary:

The preceding export commands only make the .NET 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:

/.bashrc
Korn Shell:

/.kshrc or .profile
Z Shell:

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.

Источник

Часть 1.3 — Установка .NET Core в Linux

Применяется к: .NET Core 2.1, .NET Core 3.1, .NET 5

Цель этой части

В этой части вы узнаете, как установить .NET Core на Linux.

В этом разделе предполагается, что вы используете Ubuntu и используете средство командной строки APT для установки приложений.

Предварительные условия

В этой части предполагается, что вы знаете следующие процессы:

  • Запуск команд в качестве суперузера (корневого).
  • Установка приложений с помощью диспетчеров пакетов.

Если вы, по крайней мере, не знакомы с этими процессами, обратитесь к предыдущим частям перед продолжением.

Установка .NET Core

Для поддерживаемых версий .NET Core в различных дистрибутивах Linux см. в рублях Install .NET на Linux.

В этой статье можно выбрать версию Linux для получения инструкций по распространению. Так как мы используем Ubuntu 18.04, мы будем следовать инструкциям из раздела «18.04» установки SDK .NETили времени запуска .NET на Ubuntu .

Начните с запуска следующих команд:

Первая команда — wget это команда. В соответствии со своей страницей справки, wget это не интерактивный сетевой загрузщик. Он загружает файлы с http-серверов в каталоге. Он может работать в фоновом режиме, даже если пользователь не вошел в систему. Эта команда загружает файл wget Packages-microsoft-prod.deb с packages.microsoft.com серверов текущего каталога.

Если мы запускаем команду после запуска, мы должны увидеть, что пакет ls wget загружается в текущем каталоге.

Во второй команде dpkg — диспетчер пакетов для Debian и Ubuntu. Эта команда добавляет ключ подписи пакета Майкрософт в список доверенных ключей, а затем добавляет репозиторий пакета.

Так как мы скачали и добавили новый репозиторий пакетов, диспетчеру пакетов необходимо знать об этом. Поэтому мы должны обновить диспетчер пакетов с помощью sudo apt update команды.

Теперь диспетчер пакетов знает репозиторий Microsoft, и мы можем продолжить установку.

Версии .NET Core

На момент написания статьи последняя версия .NET Core — 5.0. Рекомендуется установить последнюю версию. Однако следует также установить SDK .NET Core 3.1. Это необходимо, так как лаборатории устранения неполадок в этой серии статей предполагают, что вы используете BuggyAmb — приложение ASP.NET Core, которое мы используем для того, чтобы узнать, как устранить ASP.NET Core приложений. Текущая версия BuggyAmb — это .NET Core 3.1.

Различные версии этих приложений могут успешно работать бок о бок на одном компьютере.

Определение правильного имени пакета

В разделе «Установка других версий» в разделе Установка SDK .NET или .NET Runtime на Ubuntuпакеты .NET Core названы в формате — и имеют следующие условия:

  • Продукт — это dotnet илиaspnetcore. Обратите внимание, что aspnetcore также устанавливается при установке .NET Core.
  • Тип sdk илиruntime.
  • На момент написания статьи поддерживаемые версии .NET Core были 5.0, 3.1, 3.0 и 2.1.

Например, если вы хотите установить версию 5.0 ASP.NET Core, то продукт будет aspnetcore-runtime-5.0.

Так как для этой серии статей необходимо установить SDK .NET Core 3.1, имя пакета будет dotnet-sdk-3.1.

Вы должны знать, как установить пакеты с помощью APT. Если этого не сделать, обратитесь к предыдущим частям. Чтобы установить SDK .NET Core 3.1, запустите sudo apt install dotnet-sdk-3.1 .

Введите y и нажмите ввод. Диспетчер пакетов загружает и устанавливает как .NET Core, так и ASP.NET Core и SDKs.

Вы также можете установить SDK .NET 5.0, запуская sudo apt install dotnet-sdk-5.0 команду.

Теперь проверьте установку времени запуска и SDKs с помощью dotnet —info запуска. На следующем скриншоте показано, что время запуска .NET Core 3.1 и 5.0 и SDKs устанавливаются бок о бок.

Как .NET Core, так и ASP.NET Core время запуска устанавливаются вместе с SDK .NET Core. Если вы изучите папку SDK при запуске, вы также увидите обе ll /usr/share/dotnet/sdk версии.

В настоящее время установлены SDKs и время запуска .NET Core. В следующей части мы создадим приложение ASP.NET Core с помощью средств CLI .NET.

Заявление об отказе от ответственности за сведения о продуктах сторонних производителей

В этой статье упомянуты программные продукты независимых производителей. Корпорация Майкрософт не дает никаких гарантий, подразумеваемых и прочих, относительно производительности и надежности этих продуктов.

Источник

Читайте также:  Дистрибутивы linux для веб разработки
Оцените статью