Skip to content

Month: January 2023

Install dotnet core on Ubuntu 22.04

These are the steps I used to install dotnet core on Ubuntu 22.04, both the SDK and the runtime.

apt update
apt install -y apt-transport-https
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
apt update
apt install -y dotnet-sdk-7.0
apt update
apt install -y aspnetcore-runtime-7.0

To verify installation run the following commands. If the below doesn’t work try to open a new ssh session or terminal.

dotnet --list-runtimes

Microsoft.AspNetCore.App 7.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

dotnet --list-sdks

7.0.102 [/usr/share/dotnet/sdk]
root@srv4311:~# 

If you tried previously to install version 7.0 make sure you remove/purge the old version from the system. Something like below.

apt remove --purge dotnet-sdk-6.0 dotnet-runtime-6.0
apt auto-remove

Also maybe delete the .dotnet folder in your home directory.

Leave a Comment