April 25th, 2024

What’s new for .NET in Ubuntu 24.04

Richard Lander
Product Manager

Today is launch day for Ubuntu 24.04, Noble Numbat. Congratulations to our friends at Canonical. I’d say it’s an auspicious day, but it is more noble than that! In fact, it is the first time that a .NET release is available from day one in the official Ubuntu feeds. There is no need to wait, you can start using .NET with Ubuntu 24.04 now.

You may remember that .NET 6 was added to Ubuntu 22.04, a few months after the Ubuntu 22.04 release. We’ve learned a lot since then and significantly grown the partnership between Canonical and Microsoft. Starting with Ubuntu 24.04, Ubuntu feeds will be the official source of packages for .NET.

.NET installation docs have been updated to reflect the latest instructions.

Ubuntu 24.04 container images are already available, for .NET 8+. They include noble, noble-chiseled, and noble-chiseled-extra image flavors.

neofetch and dotnet logo on Ubuntu 24.04

Ubuntu LTS releases are always quite popular. We’re excited that .NET is part of Ubuntu 24.04 and expect a lot of .NET developers will start using these new packages and container images in the coming weeks and months.

Want to learn more? Sign up for Microsoft Build 2024, it’s free, and watch our session with experts from Canonical and Microsoft.

Packages

Installing .NET 8 on Ubuntu 24.04 is straightforward.

$ sudo apt update && sudo apt install -y dotnet-sdk-8.0
$ dotnet --version
8.0.104

Installing .NET 8 is the same as installing any other package available in Ubuntu. There are no extra feeds to configure.

.NET 6 and 7 are available in the Ubuntu .NET backports package repository (also maintained by Canonical).

Here’s how to install .NET 6 using the dotnet/backports repository.

$ sudo add-apt-repository ppa:dotnet/backports
$ sudo apt install -y dotnet-sdk-6.0
$ dotnet --version
6.0.129

.NET 7 can be installed using the same pattern, although the dotnet/backports repository only needs to be registered once.

In all cases, the gestures are simpler than registering the packages.microsoft.com feed.

Notes:

  • Install the software-properties-common package if add-apt-repository isn’t found.
  • The installation may also install tzdata, which has an interactive install.

Containers

The noble container experience is much the same as jammy. The new images support non-root, chiseled, and are globalization-ready.

The upgrade is quite straightforward. I can demonstrate with a sample Dockerfile targeting `jammy-chiseled.

$ grep jammy Dockerfile.chiseled
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled
$ sed -i "s/jammy/noble/g" Dockerfile.chiseled
$ grep noble Dockerfile.chiseled
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-noble AS build
FROM mcr.microsoft.com/dotnet/aspnet:8.0-noble-chiseled

The images are currently in nightly.

sed -i "s;/dotnet/;/dotnet/nightly/;g" Dockerfile.chiseled

We can now build and run a container.

$ docker build --pull -t aspnetapp -f Dockerfile.chiseled .
$ docker run --rm -it -p 8000:8080 -m 50mb --cpus .5 aspnetapp
warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
      Storing keys in a directory '/home/app/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed. For more information, go to https://aka.ms/aspnet/dataprotectionwarning
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
      No XML encryptor configured. Key {6326de0e-7eab-412d-9d06-eb0d019e5590} may be persisted to storage in unencrypted form.
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://[::]:8080

ASP.NET Core container image using `noble-chiseled`

That was a quick upgrade.

I did a quick size comparison, before and after. They are about the same.

$ docker images aspnetapp
REPOSITORY   TAG              IMAGE ID       CREATED          SIZE
aspnetapp    jammy-chiseled   d938d8ee1104   51 seconds ago   118MB
aspnetapp    noble-chiseled   e59689894c68   35 minutes ago   119MB

Security and support

Microsoft and Canonical are collaborating on servicing and support. To that end, Microsoft gives security and functional fixes (via a private channel) to Canonical ahead of Patch Tuesday releases, with time for building and testing. We do the same thing with Red Hat. It’s our goal that .NET fixes are available everywhere, simultaneously.

The official source of .NET packages will be via Ubuntu feeds, as already stated. That raises the question of support. You can file issues for .NET on the dotnet8 launchpad or in the appropriate dotnet repo. If there is any ambiguity on which organization should resolve the issue, we’ll handle that through our partnership.

Build 2024 Talk

Title: Seamlessly leverage .NET on Ubuntu from development to deployment

Description: Discover how Canonical and Microsoft streamline .NET development on Ubuntu. Learn about .NET packages in latest Ubuntu releases, the evolution of .NET containers, and the benefits of ultra-secure, optimized chiseled Ubuntu containers.

Closing

We’re excited for .NET to be so well integrated in Ubuntu or for the strong support of our friends at Canonical. We’ll continue to find and explore new ways to improve the experience of .NET on Ubuntu.

Author

Richard Lander
Product Manager

Richard Lander is a Program Manager on the .NET team. He works on making .NET work great in memory-limited Docker containers, on Arm hardware like the Raspberry Pi, and enabling GPIO programming and IoT scenarios. He is part of the design team that defines new .NET runtime capabilities and features. Favourite fantasy: Dune and Doctor Who. He grew up in Canada and New Zealand.

18 comments

Discussion is closed. Login to edit/delete existing comments.

  • Glaser, Thomas

    Is it possible to install .NET 6 & .NET 8 side-by-side? I attempted to add the MS repository and install both, but got a bunch of conflicts somehow.

  • Tadeas Lejsek

    Thank you for the blog post, I have two questions to it:

    1) Since ubuntu noble contains only the 8.0.1XX band of the dotnet SDK in its repositories and microsoft PPA won't be available, how should developers install the latest version of the SDK? Some tooling requires newer bands of the SDK to work (VS Code extensions etc.).

    2) Previous dotnet LTS versions used to be supported for cca 3 years, but dotnet 8 on ubuntu...

    Read more
    • Richard LanderMicrosoft employee Author

      Great topics.

      We've never had much discipline on maintaining a limited difference between the and higher bands. We're going to try to do better on that front and we ask users to keep us honest on that (by filing issues).

      https://github.com/microsoft/vscode-dotnettools/issues/1033

      When folks need or want + on Ubuntu 24.04, they will need to manually install it, either with the install script or /. This is similar to using/testing previews for a higher major version. I often...

      Read more
      • Tadeas Lejsek

        Thank you for your response. I was a bit afraid you'll say that: "When folks need or want .2xx+ on Ubuntu 24.04, they will need to manually install it". It'd be great to have an automated out-of-the-box way to stay on the latest dotnet sdk version on ubuntu noble (a.k.a apt update && apt upgrade). Anyway, does the install script support an upgrade operation (if one installs to the same location)? Or does one first...

        Read more
      • Richard LanderMicrosoft employee Author

        I understand. Our big problem is that we couldn't figure out a good way to offer a "competing" feed to what was in Ubuntu. The current model with packages.microsoft.com has been proven to not work. We are very thankful and appreciative to our friends at Canonical for offering .NET packages. We decided that it was in everyone's best interests (in aggregate) if we stopped publishing our images (starting with Noble). It has a "con", as...

        Read more
      • Chet HuskMicrosoft employee

        Hi Tadeas - unfortunately the install scripts don't have an upgrade mode today. They are only intended for acquiring SDKs and Runtimes - though you can use them multiple times to install different SDKs to the same location. To cover the update scenario, today you can delete the entire directory and download the SDK(s) you need - I realize this isn't an integrated solution.

        I do agree that this change puts more pressure on the...

        Read more
  • Mark Adamson · Edited

    Nice work. As I understand it from a previous post, ubuntu will only ever have 8.1## SDK releases, not 8.2##, 8.3## releases. Where does this leave the default GitHub Actions Ubuntu runners? Will they continue to have the later SDKs as they do at present, e.g.:

    https://github.com/actions/runner-images/blob/ubuntu22/20240407.1/images/ubuntu/Ubuntu2204-Readme.md#net-tools

    I realise it's not directly related, but only asking since GitHub is Microsoft owned now.

    Update unfortunately this did come to pass and the new Ubuntu 24.0.4 runner only includes the...

    Read more
    • Richard LanderMicrosoft employee Author

      That’s a great question. The GitHub runners install the Microsoft builds via tarballs so nothing will change.

  • David Cuccia

    Richard, this is great, thank you for your team’s work. What would be even more great is MAUI support. Please?

    • Richard LanderMicrosoft employee Author

      The MAUI team (as you likely guessed) isn’t currently targeting Linux in their plans. As a result, it isn’t part of our partnership with Canonical.

  • Craig Treasure

    Very cool to have this available on day 0! Now, if only PowerShell would follow suit…

  • Sérgio Terenas

    Richard, is there any plan to have this easy way to install/update NET8+ on Raspberry Pis? 🙏

    • Richard LanderMicrosoft employee Author · Edited

      I usually just and the from the download page: https://dotnet.microsoft.com/en-us/download/dotnet/8.0

      The install scripts also work great: https://learn.microsoft.com/dotnet/core/tools/dotnet-install-script

      Separately, we've talked to a few different folks about getting .NET into Debian (which would help with Raspberry Pi OS). We haven't been able to make that happen. It is certainly something that would be very nice.

      Important: .NET 8 works on Debian Arm32. It doesn't work on Ubuntu 24.04 Arm32. Context: https://github.com/dotnet/runtime/issues/101444

      Read more
  • Flux

    Congratulations to our friends at Canonical. I’d say it’s an auspicious day, but it is more noble than that!

    That’s one significant statement. Nobody from Microsoft has ever declared the release day of Windows 11 an auspicious day. Then again, Windows 11 deliberately doesn’t bundle .NET 8, 7, 6, or 5.

    • Richard LanderMicrosoft employee Author

      They are only in currently. That should change next month.

      https://mcr.microsoft.com/en-us/product/dotnet/nightly/aspnet/tags

      <code>

      Separately, the Docker Hub pages are not updating correctly at the moment. That page would lead you to believe that we haven't updated images since March, which is very much not true.

      Read more
      • Jiří Zídek

        Right. DockerHub lags a bit. I used to use it, because their page is way more well-arranged.