DEV Community

Cover image for Installing .NET 10 on Linux (Pop!_OS) β€” The Real Journey πŸš€
Md. Maruf Sarker
Md. Maruf Sarker

Posted on

Installing .NET 10 on Linux (Pop!_OS) β€” The Real Journey πŸš€

So today I decided:
β€œLet’s install .NET 10 on my Pop!_OS dev machine.”

Simple, right?

Microsoft docs say:

sudo apt-get update && sudo apt-get install -y dotnet-sdk-10.0
Enter fullscreen mode Exit fullscreen mode

Reality check from Linux:

E: Unable to locate package dotnet-sdk-10.0
Enter fullscreen mode Exit fullscreen mode

Linux basically said:

β€œThat package? Never heard of it bro.” πŸ’€

So here’s the full A β†’ Z journey of installing .NET 10 on Linux properly, without breaking your dev environment.


Step 0 β€” Read the Docs Completely πŸ“š

Before running any command, read the entire documentation first.

Not just the command block.

Many times we jump straight to:

copy β†’ paste β†’ run

But docs often contain important notes like:

  • supported OS versions
  • repository limitations
  • architecture support
  • alternative installation methods

If I had read the whole doc first, I would have immediately seen that the Ubuntu 22.04 repo may not contain .NET 10 yet.

Lesson learned:

Always read the entire doc, not just the command snippet.


Step 1 β€” Understand the Problem 🧠

My machine:

  • OS: Pop!_OS (Ubuntu 22.04 base)
  • Repo: Microsoft Ubuntu repo
  • Installed SDKs:
dotnet --list-sdks
Enter fullscreen mode Exit fullscreen mode

Output:

8.0.418
9.0.203
Enter fullscreen mode Exit fullscreen mode

Meaning:

Version Status
.NET 8 LTS
.NET 9 Latest
.NET 10 ❌ Not in repo

So APT couldn’t install it.


Step 2 β€” Use Microsoft's install script

When the repo doesn’t have the SDK yet, Microsoft provides an official install script.

Download it:

wget https://dot.net/v1/dotnet-install.sh
Enter fullscreen mode Exit fullscreen mode

Make it executable:

chmod +x dotnet-install.sh
Enter fullscreen mode Exit fullscreen mode

Install .NET 10:

./dotnet-install.sh --channel 10.0
Enter fullscreen mode Exit fullscreen mode

After installation the script said:

Installed version is 10.0.201
Enter fullscreen mode Exit fullscreen mode

But when I checked:

dotnet --list-sdks
Enter fullscreen mode Exit fullscreen mode

It still showed:

8.0
9.0
Enter fullscreen mode Exit fullscreen mode

Wait… what?


Step 3 β€” The PATH Problem 🧩

The script installs .NET here:

~/.dotnet
Enter fullscreen mode Exit fullscreen mode

But my system installation lives here:

/usr/share/dotnet
Enter fullscreen mode Exit fullscreen mode

So Linux was still using the APT version of dotnet.

Fix:

export DOTNET_ROOT=$HOME/.dotnet
export PATH=$HOME/.dotnet:$PATH
Enter fullscreen mode Exit fullscreen mode

Now the prompt changed instantly:

dotnet --version
10.0.201
Enter fullscreen mode Exit fullscreen mode

Nice.

But there was another problem…

Now only .NET 10 appeared.


Step 4 β€” Two Different .NET Installations

My system now had two separate dotnet environments:

Location Installed SDKs
/usr/share/dotnet 8.0, 9.0
~/.dotnet 10.0

Which is messy.

Best practice on Linux is to keep everything in:

/usr/share/dotnet
Enter fullscreen mode Exit fullscreen mode

So I installed .NET 10 system-wide.


Step 5 β€” Install .NET 10 System-wide

Run the installer with sudo:

sudo ./dotnet-install.sh --channel 10.0 --install-dir /usr/share/dotnet
Enter fullscreen mode Exit fullscreen mode

This installed:

/usr/share/dotnet/sdk/10.0.201
Enter fullscreen mode Exit fullscreen mode

Step 6 β€” Remove the Old Local Installation

Since .NET was already installed in ~/.dotnet, the shell kept using it.

Remove it:

rm -rf ~/.dotnet
Enter fullscreen mode Exit fullscreen mode

Reset bash cache:

hash -r
Enter fullscreen mode Exit fullscreen mode

Step 7 β€” Verify Everything

Now run:

dotnet --list-sdks
Enter fullscreen mode Exit fullscreen mode

Result:

8.0.418
9.0.203
10.0.201
Enter fullscreen mode Exit fullscreen mode

And:

dotnet --version
Enter fullscreen mode Exit fullscreen mode

Output:

10.0.201
Enter fullscreen mode Exit fullscreen mode

Boom.

Clean setup.


Final Linux .NET Setup πŸ’»

My machine now looks like this:

/usr/share/dotnet/sdk
β”œβ”€β”€ 8.0.418
β”œβ”€β”€ 9.0.203
└── 10.0.201
Enter fullscreen mode Exit fullscreen mode

Meaning:

SDK Purpose
.NET 8 LTS (production apps)
.NET 9 Current release
.NET 10 Latest development

Pro Tip β€” Use global.json

Real projects lock the SDK version.

Example:

{
  "sdk": {
    "version": "8.0.418"
  }
}
Enter fullscreen mode Exit fullscreen mode

This ensures:

  • teammates use the same SDK
  • CI/CD builds correctly
  • no version mismatch

dotnet #linux #backend #softwareengineering #devlife

Top comments (1)

Collapse
 
ptak_dev profile image
Patrick T

Solid.