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
Reality check from Linux:
E: Unable to locate package dotnet-sdk-10.0
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
Output:
8.0.418
9.0.203
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
Make it executable:
chmod +x dotnet-install.sh
Install .NET 10:
./dotnet-install.sh --channel 10.0
After installation the script said:
Installed version is 10.0.201
But when I checked:
dotnet --list-sdks
It still showed:
8.0
9.0
Wait⦠what?
Step 3 β The PATH Problem π§©
The script installs .NET here:
~/.dotnet
But my system installation lives here:
/usr/share/dotnet
So Linux was still using the APT version of dotnet.
Fix:
export DOTNET_ROOT=$HOME/.dotnet
export PATH=$HOME/.dotnet:$PATH
Now the prompt changed instantly:
dotnet --version
10.0.201
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
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
This installed:
/usr/share/dotnet/sdk/10.0.201
Step 6 β Remove the Old Local Installation
Since .NET was already installed in ~/.dotnet, the shell kept using it.
Remove it:
rm -rf ~/.dotnet
Reset bash cache:
hash -r
Step 7 β Verify Everything
Now run:
dotnet --list-sdks
Result:
8.0.418
9.0.203
10.0.201
And:
dotnet --version
Output:
10.0.201
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
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"
}
}
This ensures:
- teammates use the same SDK
- CI/CD builds correctly
- no version mismatch
Top comments (1)
Solid.