.Net 8 on Ubuntu 22.04

November 27, 2023 Reading time: 3 minutes Development

With the release of .Net 8, I rapidly decided to install it on my VPS running Ubuntu 22.04. We had so many new features and improvements announced that I just had to try it!

Unfortunately, I was not able to install it using the package manager. These are the steps that I've taken to have .Net 8 installed on my machine...

First I checked on the Ubuntu Package Search page just to make sure that .Net 8 was not there.

Ok. Now we are positive that jammys' repository only have packages for .Net 6 and 7.

So I basically followed the instructions on this Microsoft Learn page.

  • Register the Microsoft package repository
# Get Ubuntu version
declare repo_version=$(if command -v lsb_release &> /dev/null; then lsb_release -r -s; else grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"'; fi)

# Download Microsoft signing key and repository
wget https://packages.microsoft.com/config/ubuntu/$repo_version/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

# Install Microsoft signing key and repository
sudo dpkg -i packages-microsoft-prod.deb

# Clean up
rm packages-microsoft-prod.deb

# Update packages
sudo apt update
  • Install .Net 8 package
sudo apt update
sudo apt install aspnetcore-runtime-8.0

Notice that I won't be doing any development on my VPS so I just needed the runtime.

If you are planning to actually develop some code in your machine, you'll have to use:

sudo apt update
sudo apt install dotnet-sdk-8.0

To finish it up, make sure to check the installation:

dotnet --info