Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This article describes how to install .NET on Debian. When a Debian version falls out of support, .NET is no longer supported with that version. However, these instructions may help you to get .NET running on those versions, even though it isn't supported.
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.
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.
Important
Using a package manager to install .NET from the Microsoft package feed only supports the x64 architecture. Other architectures, such as Arm, aren't supported by the Microsoft package feed.
For more information on installing .NET without a package manager, see one of the following articles:
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.
Debian | .NET |
---|---|
12 | 9, 8 |
The following versions of .NET are ❌ no longer supported:
Preview and release candidate versions of .NET aren't available in package repositories. You can install previews and release candidates of .NET in one of the following ways:
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.
Installing with APT can be done with a few commands. Before you install .NET, run the following commands to add the Microsoft package signing key to your list of trusted keys and add the package repository.
Open a terminal and run the following commands:
wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
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 apt-get update && \
sudo apt-get install -y dotnet-sdk-9.0
To learn how to use the .NET CLI, see .NET CLI overview.
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 apt-get update && \
sudo apt-get install -y aspnetcore-runtime-9.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-9.0
in the previous command with dotnet-runtime-9.0
:
sudo apt-get install -y dotnet-runtime-9.0
To learn how to use the .NET CLI, see .NET CLI overview.
When a new patch release is available for .NET, you can simply upgrade it through APT with the following commands:
sudo apt-get update
sudo apt-get upgrade
If you've upgraded your Linux distribution since installing .NET, you may need to reconfigure the Microsoft package repository. Run the installation instructions for your current distribution version to upgrade to the appropriate package repository for .NET updates.
This section provides information on common errors you may get while using APT to install .NET.
Important
Using a package manager to install .NET from the Microsoft package feed only supports the x64 architecture. Other architectures, such as Arm, aren't supported by the Microsoft package feed.
For more information on installing .NET without a package manager, see one of the following articles:
If you receive an error message similar to Unable to locate package {dotnet-package} or Some packages could not be installed, run the following commands.
There are two placeholders in the following set of commands.
{dotnet-package}
aspnetcore-runtime-8.0
. This is used in the following sudo apt-get install
command.First, try purging the package list:
sudo dpkg --purge packages-microsoft-prod && sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
Then, try to install .NET again. If that doesn't work, you can run a manual install with the following commands:
If you're using Debian 12 or later, try the following commands:
# Get OS version info which adds the $ID and $VERSION_ID variables
source /etc/os-release
# Download the Microsoft keys
sudo apt-get install -y gpg wget
wget https://packages.microsoft.com/keys/microsoft.asc
cat microsoft.asc | gpg --dearmor -o microsoft.asc.gpg
# Add the Microsoft repository to the system's sources list
wget https://packages.microsoft.com/config/$ID/$VERSION_ID/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
# Move the key to the appropriate place
sudo mv microsoft.asc.gpg $(cat /etc/apt/sources.list.d/microsoft-prod.list | grep -oP "(?<=signed-by=).*(?=\])")
# Update packages and install .NET
sudo apt-get update && \
sudo apt-get install -y {dotnet-package}
If you're using a Debian version prior to 12, try the following commands:
# Define the OS version, name, and codename
source /etc/os-release
# Download the Microsoft keys
sudo apt-get install -y gpg wget
wget https://packages.microsoft.com/keys/microsoft.asc
cat microsoft.asc | gpg --dearmor -o microsoft.asc.gpg
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
# Add the Microsoft repository to the system's sources list
wget https://packages.microsoft.com/config/$ID/$VERSION_ID/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
# Set ownership
sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list
# Update packages and install .NET
sudo apt-get update && \
sudo apt-get install -y {dotnet-package}
While installing the .NET package, you may see an error similar to Failed to fetch ... File has unexpected size ... Mirror sync in progress?
. This error could mean that the package feed for .NET is being upgraded with newer package versions, and that you should try again later. During an upgrade, the package feed shouldn't be unavailable for more than 30 minutes. If you continually receive this error for more than 30 minutes, please file an issue at https://github.com/dotnet/core/issues.
When you install with a package manager, these libraries are installed for you. But, if you manually install .NET or you publish a self-contained app, you'll need to make sure these libraries are installed:
Dependencies can be installed with the apt install
command. The following snippet demonstrates installing the libc6
library:
sudo apt install libc6
If the .NET app uses the System.Drawing.Common assembly, libgdiplus must be installed. For more information, see System.Drawing.Common only supported on Windows.
You can install a recent version of libgdiplus by adding the Mono repository to your system.
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Create a new .NET project and work with package dependencies - Training
Create a .NET project and learn to add packages and manage package dependencies in your project. Use the .NET Core CLI and NuGet registry to add libraries and tools to your C# applications through Visual Studio Code.
Documentation
Install .NET on Linux without using a package manager - .NET
Demonstrates how to install the .NET SDK and the .NET Runtime on Linux without a package manager. Use the install script or manually extract the binaries.
.NET and Ubuntu overview - .NET
Learn about the ways you can install .NET on Ubuntu, either from the built-in package feed, the .NET backports repository, or the Microsoft repository.
Install .NET SDK on Linux with Snap - .NET
Learn about how to install the .NET SDK snap package. Canonical maintains and supports .NET-related snap packages.