apt install dotnet-sdk-5.0 not working?

asheroto
2 min readFeb 15, 2021
After installing the Microsoft repository to apt and installing dotnet-sdk-5.0

It’s because it’s Microsoft, what did you expect?

Haha. Okay, this article contains a real answer.

It’s not available with the default apt repository, but you can add Microsoft’s repository and then it will work.

You have two options…

The APT Method
- If you want to use apt to manage dot net
- You know your OS and version number
- If you want dotnet installed on your system

The Script Method
- If you don’t care about managing dotnet through apt
- If you don’t know your OS or version number (such as when scaling)
- If you just want dotnet installed super fast
- If you want dotnet installed to your user profile

The Apt Method

CentOS

  • CentOS 8
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -`curl -sSL https://packages.microsoft.com/config/centos/8/prod.list | sudo tee /etc/apt/sources.list.d/microsoft-prod.listsudo apt updatesudo apt install dotnet-sdk-5.0
  • CentOS 7
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -`curl -sSL https://packages.microsoft.com/config/centos/7/prod.list | sudo tee /etc/apt/sources.list.d/microsoft-prod.listsudo apt updatesudo apt install dotnet-sdk-5.0

Debian

  • Debian 10 (Buster)
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -`curl -sSL https://packages.microsoft.com/config/debian/10/prod.list | sudo tee /etc/apt/sources.list.d/microsoft-prod.listsudo apt updatesudo apt install dotnet-sdk-5.0
  • Debian 9 (Jessie)
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -`curl -sSL https://packages.microsoft.com/config/debian/9/prod.list | sudo tee /etc/apt/sources.list.d/microsoft-prod.listsudo apt updatesudo apt install dotnet-sdk-5.0

Ubuntu

  • Ubuntu 16.04 (Xenial)
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -sudo apt-add-repository https://packages.microsoft.com/ubuntu/16.04/prodsudo apt-get update
  • Ubuntu 18.04 (Bionic)
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -sudo apt-add-repository https://packages.microsoft.com/ubuntu/18.04/prodsudo apt-get update
  • Ubuntu 20.04 (Focal)
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -sudo apt-add-repository https://packages.microsoft.com/ubuntu/20.04/prodsudo apt-get update

All available OS’s and OS versions

Microsoft article

The Script Method

wget dot.net/v1/dotnet-install.sh -O dotnet.shbash dotnet.sh -c 5.0

Yeah it’s THAT quick and easy.

If you use this method, dotnet installs to your user profile, not your system, even if you run the script as root. So you can use this method, but instead of dotnet you will have to type ~/.dotnet/dotnet. Do not move this application to /bin or similar — you will end up with compile errors down the road.

--

--

asheroto

🌎 Full Stack Developer 🔗 Systems Administrator 😎Innovation through Automation ✔ Privacy Advocate ♥ Startup Facilitator