Net framework ��� linux

Установка пакета SDK для .NET или среды выполнения .NET вручную

Платформа .NET поддерживается в Linux. В этой статье описывается установка .NET в Linux с помощью скрипта установки или посредством извлечения двоичных файлов. Список дистрибутивов, поддерживающих встроенный диспетчер пакетов, см. в разделе Установка .NET в Linux.

Также можно установить .NET с помощью пакета Snap. Дополнительные сведения см. в разделе Установка пакета SDK для .NET или среды выполнения .NET с использованием пакета Snap.

Если вы хотите разрабатывать приложения .NET, установите пакет SDK (включает среду выполнения). Если нужно просто запустить приложения, установите среду выполнения. Если вы устанавливаете среду выполнения, мы рекомендуем установить среду выполнения ASP.NET Core, так как она включает в себя среды выполнения .NET и ASP.NET Core.

Если вы уже установили пакет SDK или среду выполнения, с помощью команд dotnet —list-sdks и dotnet —list-runtimes узнайте, какие версии установлены. Дополнительные сведения см. в статье Проверка того, установлена ли платформа .NET.

Выпуски .NET

В следующей таблице перечислены выпуски .NET (и .NET Core):

✔️ Поддерживается ❌ Не поддерживается
5,0 3.0
3.1 (LTS) 2.2
2.1 (LTS) 2,0
1,1
1.0

Дополнительные сведения о жизненном цикле выпусков .NET см. в разделе Политика поддержки .NET Core и .NET 5.

Зависимости

В некоторых случаях, например при установке .NET вручную, некоторые зависимости могут не устанавливаться. Ниже перечислены дистрибутивы Linux, которые поддерживаются корпорацией Майкрософт и для которых может потребоваться установка зависимостей. Дополнительные сведения см. на странице, посвященной соответствующему дистрибутиву:

Общие сведения о зависимостях см. в статье об автономных приложениях Linux.

Зависимости RPM

Если ваш дистрибутив не указан в приведенном выше списке и построен на основе RPM, могут потребоваться следующие зависимости:

Если в целевой среде выполнения установлена версия OpenSSL 1.1 или более поздняя, необходимо установить compat-openssl10.

Зависимости DEB

Если ваш дистрибутив не указан в приведенном выше списке и построен на основе Debian, могут потребоваться следующие зависимости:

Общие зависимости

Для приложений .NET, использующих сборку System.Drawing.Common, необходима также следующая зависимость:

Вы можете установить последнюю версию libgdiplus, добавив в систему репозиторий Mono. Для получения дополнительной информации см. https://www.mono-project.com/download/stable/.

Установка с помощью скрипта

Сценарии dotnet-install используются для автоматизации установок пакета SDK и среды выполнения и осуществления таких установок без прав администратора. Скрипт можно скачать на странице https://dot.net/v1/dotnet-install.sh.

![ВАЖНО] Для выполнения скрипта требуется Bash.

Этот сценарий по умолчанию устанавливает последнюю версию SDK с долгосрочной поддержкой (LTS), которой сейчас является .NET Core 3.1. Чтобы установить текущий выпуск, который может не быть версией LTS, используйте параметр -c Current .

Чтобы вместо пакета SDK установить среду выполнения .NET, используйте параметр —runtime .

Вы можете установить определенную версию, указав ее в параметре -c . Следующая команда устанавливает пакет SDK для .NET 5.0.

Установка вручную

В качестве альтернативы диспетчерам пакетов можно скачать и вручную установить пакет SDK и среду выполнения. Установка вручную как правило выполняется в рамках тестирования непрерывной интеграции или в неподдерживаемом дистрибутиве Linux. В большинстве случаев разработчикам и пользователям рекомендуется использовать диспетчер пакетов.

Сначала скачайте двоичный выпуск пакета SDK или среды выполнения с одного из следующих сайтов. При установке пакета SDK для .NET не нужно устанавливать соответствующую среду выполнения:

Затем извлеките скачанный файл и используйте команду export , чтобы задать для переменной DOTNET_ROOT расположение извлеченной папки, а затем проверьте включение .NET в переменную PATH. После этого команды .NET CLI станут доступны в терминале.

Кроме того, после скачивания двоичного файла .NET можно выполнить следующие команды из каталога, в котором сохранен файл, для извлечения среды выполнения. После этого команды .NET CLI также станут доступны в терминале, и будут заданы нужные переменные среды. Обязательно измените значение DOTNET_FILE на имя скачанного двоичного файла:

Приведенные выше команды export сделают команды .NET CLI доступными только для сеанса терминала, в котором производился запуск.

Вы можете изменить профиль оболочки, чтобы добавить команды окончательно. Существует несколько различных оболочек, доступных для Linux, и каждая из них имеет свой профиль. Пример:

    Оболочка Bash:

/.bashrc
Оболочка Korn:

/.kshrc или .profile
Оболочка Z:

Измените соответствующий исходный файл оболочки и добавьте :$HOME/dotnet в конец существующего оператора PATH . Если оператор PATH не указан, добавьте новую строку с export PATH=$PATH:$HOME/dotnet .

Кроме того, добавьте export DOTNET_ROOT=$HOME/dotnet в конец файла.

Такой подход позволяет устанавливать разные версии в отдельные расположения и выбирать, какие из них следует использовать для каждого приложения.

Источник

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.

Источник

Читайте также:  Windows 10 постоянно тормозит
Оцените статью