How to Install .NET 9 on Ubuntu (3 Easy Methods)

By
admin
3 Min Read

With the release of .NET 9, Ubuntu users can now take advantage of improved performance, better cloud-native support, and updated tooling. In this guide, you’ll learn how to install .NET 9 SDK and .NET 9 Runtime on any Ubuntu-based system using Snap, script installation, or APT.


🔍 Why Install .NET 9?

.NET 9 brings major improvements, including:

  • Faster execution performance
  • Enhanced container support
  • New C# features
  • Better cross-platform compatibility

If you’re building modern APIs, microservices, or cloud applications, .NET 9 is the recommended version.


Method 1: Install .NET 9 Using Snap (Fast & Easy)

Snap packages are the simplest way to install .NET on Ubuntu since they come directly from Microsoft.

Step 1 — Install the .NET 9 SDK

sudo snap install dotnet-sdk --classic --channel=9.0
sudo snap alias dotnet-sdk.dotnet dotnet

You should see something like:

dotnet-sdk (9.0/stable) from Microsoft .NET Core installed

Step 2 — Install the .NET 9 Runtime

sudo snap install dotnet-runtime-90 --classic
sudo snap alias dotnet-runtime-90.dotnet dotnet

Step 3 — Export DOTNET_ROOT

export DOTNET_ROOT=/snap/dotnet-sdk/current

Step 4 — Check Installation

dotnet --info

Method 2: Scripted Install (Perfect for CI/CD or Non-Sudo Use)

The official install script lets you install .NET 9 locally without needing root access.

Step 1 — Download the Script

wget https://dot.net/v1/dotnet-install.sh

Step 2 — Install .NET 9

bash dotnet-install.sh -c 9.0

This installs .NET 9 inside your user directory.
No system-wide changes needed.


Step 1 — Add Required Repository

sudo add-apt-repository universe

Step 2 — Enable HTTPS Transport

sudo apt-get install apt-transport-https

Step 3 — Add Microsoft Package Repository

wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb

Step 4 — Update Package List

sudo apt-get update

Step 5 — Install .NET 9 SDK

sudo apt-get install dotnet-sdk-9.0

To install only the runtime:

sudo apt-get install dotnet-runtime-9.0

Alternative: Manual Download

You can manually download .NET 9 from the official site:

➡️ https://dotnet.microsoft.com/en-us/download/dotnet/9.0

Useful for offline machines or portable development environments.


Final Thoughts

Installing .NET 9 on Ubuntu is straightforward once you choose the right method:

MethodBest For
SnapQuick install, beginners
ScriptCI/CD, no-sudo environments
APTStable production setups

With .NET 9 installed, you’re ready to build modern cloud-native apps on Ubuntu!

TAGGED:
Share This Article
1 Comment
  • Nice breakdown of the installation methods! Just wondering if the Snap method works smoothly for CI/CD pipelines as well, or if the Scripted Install is more suitable?

Leave a Reply

Your email address will not be published. Required fields are marked *