The .NET is a free and open source development platform by Microsoft that allows you to build and run applications efficiently for web, desktop, mobile, cloud, and more. Even though it is associated with Windows, .NET also works smoothly on Linux, which gives developers the flexibility to use whatever operating system they prefer.
So whether you are a proficient C# user or are moving on to Linux, .NET is the perfect choice for you.
In this guide, we will walk through the steps to set up .NET on various Linux distributions, verifying the installation, and how to run your first application.
Why Use .NET on Linux?
Using .Net with Linux has multiple benefits, such as:
- It allows you to do cross platform development, build apps that run on Linux, Windows, and macOS without changing the basic code.
- It is completely open source and forever free, which means you get constant community support and regular updates.
- Since .NET applications are famous for their high performance, scalability, and reliability, even on Linux servers.
- Using .NET Linux, you can write the code in C#, F#, or Visual Basic while taking the advantage of Linux’s stability.
- It is ideal for Docker-based deployments, Kubernetes environments, and cloud native apps.
Prerequisites for Installing .NET on Linux
Before you go on installing .NET Linux, make sure that you can:
- A supported Linux distribution (Ubuntu, Debian, Fedora, Arch, Manjaro, etc.)
- Sudo/root access to install packages and update system repositories.
- An internet connection to download the SDK and runtime.
- Basic terminal knowledge to run commands and navigate directories.
- Updated system packages to avoid compatibility issues during installation.
How to Install .NET Linux: Step-by-Step Guide
Using the official Microsoft packages repositories for most Linux distributions. Here is how you can do so on different operating systems.
Get exclusive access to all things tech-savvy, and be the first to receive
the latest updates directly in your inbox.
Installing .NET on Ubuntu/Debian
Follow these steps for Ubuntu/Debian:
- Step 1: Update your package list
sudo apt update
sudo apt install -y wget apt-transport-https
- Step 2: Add Microsoft package repository
wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt update
- Step 3: Install the .NET SDK
sudo apt install -y dotnet-sdk-8.0
Replace 8.0 with the version you need (e.g., 7.0, 6.0).
- Step 4: Verify
dotnet –version
Installing .NET on RHEL/Fedora
For RHEL/ Fedore follow:

- Step 1: Install required dependencies
sudo dnf install -y wget
- Step 2: Add Microsoft package repository
wget https://packages.microsoft.com/config/fedora/$(rpm -E %fedora)/packages-microsoft-prod.rpm
sudo rpm -Uvh packages-microsoft-prod.rpm
sudo dnf update
- Step 3: Install the .NET SDK
sudo dnf install -y dotnet-sdk-8.0
- Step 4: Verify
dotnet –version
Installing .NET on Arch/Manjaro
Arch Linux and Manjaro both have .NET available in their community repositories.
- Step 1: Update packages
sudo pacman -Syu
- Step 2: Install the .NET SDK
sudo pacman -S dotnet-sdk
- Step 3: Verify
dotnet –version
Verify .NET Installation
After you are done installing .NET Linux, verify the installation and check the version by running: dotnet –version
If the output returns the .NET version, then the platform is successfully installed and ready to use.
Running Your First .NET App on Linux
After successful installation, you can run your first .NET Linux application in a few simple steps:
- Create a new console app
dotnet new console -o MyApp
- Navigate into the project folder
cd MyApp
- Run the app
dotnet run
This should return a simple “hello world” output.
Managing Multiple .NET SDK Versions
If you are managing multiple different .NET SDK versions, using the dotnet –list-sdks command to view them:
dotnet –list-sdks
If you are targeting a specific version for a project at a specific time, create a global.json file in the project root:
dotnet new globaljson –sdk-version 8.0.100
Replace 8.0.100 with the SDK version you want to use.
Updating and Uninstalling .NET on Linux
If you are using an older version of .NET Linux, you can also update it by running simple commands on the terminal:
- On Ubuntu/Debian:
sudo apt update && sudo apt upgrade dotnet-sdk-8.0
- On RHEL/Fedora:
sudo dnf upgrade dotnet-sdk-8.0
- On Arch/Manjaro:
sudo pacman -Syu dotnet-sdk
If you are no longer using .NET Linux you can always uninstall it, using:
- Ubuntu/Debian:
sudo apt remove dotnet-sdk-8.0
- RHEL/Fedora:
sudo dnf remove dotnet-sdk-8.0
- Arch/Manjaro:
sudo pacman -R dotnet-sdk
Common Installation Issues and Fixes
Issue | Possible Cause | Fix |
dotnet: command not found | .NET not installed or PATH not updated | Reinstall .NET and ensure Microsoft’s repo is added correctly |
“Unable to locate package dotnet-sdk” | Repository not added | Re-add Microsoft package repo and run sudo apt update or sudo dnf update |
Permission denied during install | No root privileges | Use sudo before installation commands |
Wrong version installed | Default package manager version differs | Specify exact version (e.g., dotnet-sdk-8.0) |
Missing dependencies | Outdated system packages | Update your system with sudo apt upgrade / sudo dnf upgrade / sudo pacman -Syu |
Conclusion: Using .NET Linux Seamlessly
Using .NET on Linux is super simple and effective, which gives developers the freedom to build and run powerful applications. Download .NET on Linux using the command line interface, so that you have full control over the development environment, while keeping it lightweight and effective.
FAQs
Can I install .NET on all Linux distributions?
Yes, .NET supports major Linux distributions like Ubuntu, Debian, Fedora, and CentOS, but installation commands differ slightly.
How do I check my installed .NET version in Linux?
Run dotnet --version
in the terminal to check the installed version.
Can I build and run apps with .NET CLI on Linux?
Yes, you can create projects using dotnet new
and run them with dotnet run
entirely from the terminal.
Do I need root privileges to install .NET on Linux?
Yes, root or sudo privileges are required to install .NET system-wide on Linux.