How to Install .NET Core (dotnet) SDK on Ubuntu Linux
.NET Core (dotnet) SDK is a collection of Microsoft software tools that let you build and run apps on Ubuntu Linux. This software pack gives you the compiler, libraries, and runtime needed to create programs in languages like C#.
Ubuntu supports major releases like .NET 6 and .NET 8 with long-term updates. Setup takes just a few steps using the terminal command line on your PC.
Install the .NET SDK on Ubuntu by first updating apt and installing `apt-transport-https`. Then, add the Microsoft package repository and install `dotnet-sdk-6.0` using `apt install`. Verify the installation with `dotnet –list-sdks`.
How to install dotnet (.NET) SDK on Ubuntu Linux
To install the .NET Core SDK Ubuntu setup requires adding Microsoft’s software repository to your system so you can download and install the development tools. You will register the Microsoft package signing key, add the software feed to your package manager, and then use the apt command-line tool to download the software package.
Below is how to install it on Ubuntu Linux.
This package allows you to install the .NET SDK securely via HTTPS.
To do that, install the apt-transport-HTTP package using the command below.
sudo apt update sudo apt install apt-transport-https
Add .NET Repository
Adding the .NET repository to your Ubuntu system tells your package manager where to download official Microsoft software packages. You use the wget command to download the Microsoft configuration package and install it using dpkg so your system trusts the official software feed.
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb
The lines above create a /etc/apt/sources.list.d/microsoft-prod. Next, list the repository file on your Ubuntu Linux system with appropriate config settings.
If you're using a different version of Ubuntu Linux, replace the highlighted version number in the commands above.
Install .NET Core SDK on Ubuntu Linux
Installing the .NET Core SDK on Ubuntu Linux requires updating your local package list and running the installation command for your chosen version. You use the sudo apt update command followed by sudo apt install dotnet-sdk-6.0 to set up the development environment on your computer.
sudo apt update sudo apt install dotnet-sdk-6.0
After installing, you should get a success message similar to the one below:
Welcome to .NET! --------------------- Learn more about .NET: https://aka.ms/dotnet-docs Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs
Once .NET SDK is installed, you can verify by running the commands below.
dotnet --list-sdks
The command above will display the version of .NET installed.
Output: 6.0.300 [/usr/share/dotnet/sdk]
Also, verify that the .NET runtime is functioning.
dotnet --list-runtimes
That should display similar lines as shown below:
Output: Microsoft.AspNetCore.App 6.0.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
The commands below can also be used to install .NET Framework independently.
sudo apt install dotnet-runtime-6.0
How to install .NET Core SDK on Ubuntu via Snap
Installing the .NET Core SDK on Ubuntu via Snap gives you an alternative method that packages the software with all its required dependencies. You use the snap command-line tool to install the .NET SDK directly without needing to configure external software repositories or signing keys.
Snaps are containerized software packages that are simple to create and install.
Snap applications are packaged with all their dependencies to run on all popular Linux distributions from a single build, allowing them to update automatically and roll back gracefully.
To install .NET via snap, run the commands below:
sudo apt install snap sudo snap install dotnet-sdk --classic
After installing, you can begin building great applications.
That should do it!
Conclusion:
- Microsoft .NET Core SDK is a versatile, cross-platform framework supporting Linux and Mac OS systems, including Ubuntu Linux.
- With the ability to install the SDK via the Software Development Kit (SDK), along with the .NET Runtime, developers can seamlessly build and run .NET applications on Ubuntu Linux.
- Users have the option to install the .NET Core SDK either through traditional package management or via the Snap package, providing flexibility and convenience.
- The Long Term Support (LTS) version 6.0 of .NET Core SDK, supported for 3 years, features improved git integration with Visual Studio 2022, enhancing the development experience on Ubuntu Linux.
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.
No comments yet — be the first to share your thoughts!