How to Install DotNet SDK In Ubuntu Based Distros?


My Distro

I am using linux mint 22.1 which is based on Ubuntu 24.04.

Straightforeward command

sudo apt-get update

sudo apt-get install -y dotnet-sdk-9.0

But…

I have tried to run this command sudo apt-get install -y dotnet-sdk-9.0 but unfortunately I got no success. I have found that, this command works only with Ubuntu 24.10. For Ubuntu 24.04 I need to use different approach.

Uninstall prior version if exists

sudo apt-get remove dotnet-sdk-8.0

Now, run these commands in a sequence:

sudo apt-get update

sudo apt-get install -y software-properties-common

sudo add-apt-repository ppa:dotnet/backports

sudo apt-get install -y dotnet-sdk-9.0