Install .NET SDK or .NET Runtime on Ubuntu 22.04
This article discusses how to install .NET on Ubuntu 22.04; .NET 6 and .NET 7 are 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
Package manager installs are only supported on the x64 architecture. Other architectures, such as Arm, must install .NET by some other means such as with Snap, an installer script, or through a manual binary installation.
For more information on installing .NET without a package manager, see one of the following articles:
.NET is available in the Ubuntu package manager feeds, as well as the Microsoft package repository. However, you should only one use or the other to install .NET. If you want to use the Microsoft package repository, see How to register the Microsoft package repository.
Supported versions
The following versions of .NET are supported or available for Ubuntu 22.04:
Supported .NET versions | Available in Ubuntu feed | Available in Microsoft feed |
---|---|---|
7.0, 6.0 | 6.0 | 7.0, 6.0, 3.1 |
When an Ubuntu version falls out of support, .NET is no longer supported with that version.
The following versions of .NET are ❌ no longer supported:
- .NET 5
- .NET Core 3.1
- .NET Core 3.0
- .NET Core 2.2
- .NET Core 2.1
- .NET Core 2.0
Install .NET 7
.NET 7 packages aren't available in the Ubuntu package manager feeds. You must use the Microsoft package repository.
Warning
If you've previously installed .NET 6 from the Ubuntu feed, you'll run into issues installing .NET 7 from the Microsoft package repository. .NET is installed to different locations and is resolved differently for both package feeds. It's recommended that you uninstall .NET 6 and then install with the Microsoft package repository.
For more information about how to clean your system and install .NET 7, see I need a version of .NET that isn't provided by my Linux distribution.
Install .NET 6
This section describes how to install .NET 6.
Install .NET 6 SDK
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-6.0
Important
If you receive an error message similar to Unable to locate package dotnet-sdk-6.0, see the troubleshooting section.
Install .NET 6 Runtime
Both .NET Runtime and the ASP.NET Core Runtime allow 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-6.0
Important
If you receive an error message similar to Unable to locate package aspnetcore-runtime-6.0, see the troubleshooting section.
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-6.0
in the previous command with dotnet-runtime-6.0
:
sudo apt-get install -y dotnet-runtime-6.0
How to install other versions
Other versions of .NET aren't supported in the Ubuntu feeds. Instead, use the Microsoft package repository.
Troubleshooting
If you run into issues installing or even running .NET, see Troubleshooting.
Dependencies
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:
- libc6
- libgcc1
- libgcc-s1
- libgssapi-krb5-2
- libicu71
- liblttng-ust1
- libssl3
- libstdc++6
- libunwind8
- zlib1g
If the .NET app uses the System.Drawing.Common assembly, libgdiplus will also need to be installed. Because System.Drawing.Common is no longer supported on Linux, this only works on .NET 6 and requires setting the System.Drawing.EnableUnixSupport
runtime configuration switch.
You can install a recent version of libgdiplus by adding the Mono repository to your system.
Next steps
Feedback
Submit and view feedback for