Getting Started with .NET 10 on Ubuntu 26.04: A Complete Setup Guide

<h2>Introduction</h2> <p>With the release of Ubuntu 26.04 (Resolute Raccoon), Canonical delivers the latest LTS with built-in support for .NET 10. Whether you're a developer building cloud-native applications or a system administrator deploying services, this guide walks you through installing, testing, and using .NET on the new Ubuntu. We'll cover installation from the official repositories, running your first C# script, working with Ubuntu 26.04 containers, and highlight key new features like post-quantum cryptography and cgroup v2. By the end, you'll have a fully functional .NET 10 environment ready for development or production.</p><figure style="margin:20px 0"><img src="https://devblogs.microsoft.com/dotnet/wp-content/uploads/sites/10/2026/04/whats-new-for-dotnet-in-ubuntu-2604.webp" alt="Getting Started with .NET 10 on Ubuntu 26.04: A Complete Setup Guide" style="width:100%;height:auto;border-radius:8px" loading="lazy"><figcaption style="font-size:12px;color:#666;margin-top:5px">Source: devblogs.microsoft.com</figcaption></figure> <h2 id="what-you-need">What You Need</h2> <ul> <li>A machine running <strong>Ubuntu 26.04</strong> (Resolute Raccoon) – either bare metal, VM, or a container instance.</li> <li><strong>sudo</strong> privileges to install packages.</li> <li>An active <strong>internet connection</strong> to download packages and container images.</li> <li>Basic familiarity with the terminal and command-line tools.</li> <li>(Optional) <strong>Docker</strong> installed if you want to run Ubuntu 26.04 container images.</li> </ul> <h2 id="step-by-step-instructions">Step-by-Step Instructions</h2> <h3>Step 1: Update Package List and Install .NET 10 SDK</h3> <p>Open a terminal and run the following commands to refresh the package database and install the .NET 10 SDK. Ubuntu 26.04 repositories include the <code>dotnet-sdk-10.0</code> package directly.</p> <pre><code>sudo apt update sudo apt install -y dotnet-sdk-10.0</code></pre> <p>This command installs the complete SDK, which includes the runtime, libraries, and command-line tools like <code>dotnet</code>.</p> <h3>Step 2: Verify the Installation</h3> <p>Check that .NET is installed correctly by displaying the version:</p> <pre><code>dotnet --version</code></pre> <p>You should see output like <code>10.0.105</code> (or a similar version number).</p> <h3>Step 3: Run Your First C# Code</h3> <p>You can quickly test that everything works by running a tiny C# script directly from the terminal using a heredoc. This approach is handy for quick experiments or even for AI agents to execute code.</p> <pre><code>dotnet run - &lt;&lt; 'EOF' using System.Runtime.InteropServices; Console.WriteLine($"Hello {RuntimeInformation.OSDescription} from .NET {RuntimeInformation.FrameworkDescription}"); EOF</code></pre> <p>If successful, you'll see output similar to:</p> <pre><code>Hello Ubuntu Resolute Raccoon (development branch) from .NET .NET 10.0.5</code></pre> <p>This demonstrates that .NET is functioning and can access your system's OS description.</p> <h3>Step 4: (Optional) Install Older .NET Versions via PPA</h3> <p>While .NET 10 is the default LTS, you may need .NET 8 or 9 for compatibility. Canonical provides a separate PPA for these versions. Follow these substeps:</p> <ol> <li><strong>Add the PPA repository:</strong> <pre><code>sudo add-apt-repository ppa:dotnet/backports sudo apt update</code></pre> </li> <li><strong>Install the desired SDK or runtime:</strong> <pre><code>sudo apt install dotnet-sdk-8.0 # For .NET 8 sudo apt install dotnet-sdk-9.0 # For .NET 9</code></pre> </li> <li><strong>Switch between versions</strong> using the <code>dotnet --list-sdks</code> command and setting the <code>DOTNET_ROOT</code> environment variable if needed.</li> </ol> <h3>Step 5: Using Ubuntu 26.04 Container Images with .NET 10</h3> <p>Ubuntu 26.04 container images are available for .NET 10+ and use the <code>resolute</code> tag. To run .NET 10 inside a container:</p><figure style="margin:20px 0"><img src="https://uhf.microsoft.com/images/microsoft/RE1Mu3b.png" alt="Getting Started with .NET 10 on Ubuntu 26.04: A Complete Setup Guide" style="width:100%;height:auto;border-radius:8px" loading="lazy"><figcaption style="font-size:12px;color:#666;margin-top:5px">Source: devblogs.microsoft.com</figcaption></figure> <pre><code>docker run --rm -it ubuntu:resolute apt update apt install -y dotnet-sdk-10.0 dotnet --version</code></pre> <p>If you already use <code>ubuntu:noble</code> (24.04) images, you can simply replace <code>noble</code> with <code>resolute</code> to upgrade the base OS without changing your .NET version. The container image flavors (like Chiseled) remain the same as before.</p> <h3>Step 6: Understand Key New Features in Ubuntu 26.04 for .NET Developers</h3> <p>Ubuntu 26.04 introduces several changes that affect .NET applications:</p> <ul> <li><strong>Linux Kernel 7.0:</strong> The new kernel brings performance improvements. .NET testing against this kernel will begin shortly after VMs become available in our lab.</li> <li><strong>Post-Quantum Cryptography:</strong> .NET 10 adds support for post-quantum cryptographic algorithms. This is particularly relevant for secure communications in a future where quantum computers become prevalent.</li> <li><strong>Cgroup v2 Only:</strong> The old cgroup v1 has been removed. .NET has supported cgroup v2 for many years, so this change should not affect properly updated applications. Containers and process isolation will work seamlessly.</li> </ul> <h2 id="tips">Tips</h2> <ul> <li><strong>Container kernel awareness:</strong> A container running on an Ubuntu 26.04 image uses the host's kernel. For example, a 26.04 container hosted on a 24.04 host will run with the Linux 6.x kernel. Always verify the host kernel if you rely on kernel-specific features.</li> <li><strong>AI agents and .NET:</strong> The heredoc method shown in Step 3 works perfectly with AI agents that typically execute Python scripts. You can tell them to run C# code the same way – it's a great way to leverage generative AI for .NET development.</li> <li><strong>Staying up to date:</strong> Because .NET is an officially supported toolchain on Ubuntu, Canonical and Microsoft work together to ensure smooth upgrades. Regularly run <code>sudo apt update && sudo apt upgrade</code> to get the latest patches.</li> <li><strong>Testing against nightly builds:</strong> The dotnet/runtime repository validates every PR against Ubuntu 26.04 container images. This continuous testing means that by the time you install the release, it's already battle-tested.</li> <li><strong>Migrating existing apps:</strong> If you have Dockerfiles referencing <code>dotnet/aspnet</code> images, update the base tag from <code>noble</code> to <code>resolute</code> to adopt the new OS. For example, change <code>FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble</code> to <code>...10.0-resolute</code>.</li> </ul>
Tags: