Want to download and install .NET 5 on your Ubuntu machine but can't figure out how? This guide will take you through the complete process of installing .NET 5 (Dotnet 5) on Ubuntu Linux 20.04 (LTS). Dotnet 5 is the latest version in the .NET Core family and it supports even more application types and platforms than its predecessor.

Although this article will focus on installing .NET 5 on Ubuntu Linux, Dotnet 5 is also supported on other Linux distros such as CentOS, Red Hat Enterprise Linux, Alpine, etc.

What Is .NET 5?

The .NET framework has been in existence since 2002. At the time of its first release, the framework was only supported on the Windows operating system. Microsoft is currently responsible for the development and distribution of the framework.

Unlike the initial .NET framework, .NET 5 is a cross-platform and open-source framework. You can develop and run .NET 5 applications on other platforms such as Linux and macOS. Best of all, Dotnet 5 is modular and lightweight.

Related: Open Source vs. Free Software: What's the Difference?

Installing .NET SDK on Ubuntu

If you want to install the .NET framework for both developing and running .NET apps, then first, you will have to install the .NET Software Development Kit (SDK), which also includes the .NET Runtime by default.

First, add the Microsoft package repository to your system's package list. In addition, include Microsoft's package signing key to your collection of trusted keys.

        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

After adding the new package repository, get the latest package information from your package sources using apt.

        sudo apt update
    

To be able to install the .NET SDK securely via HTTPS, make sure to install the apt-transport-https package using the command below.

        sudo apt install apt-transport-https
    

Then, install the .NET 5 SDK using the following command.

        sudo apt-get install -y dotnet-sdk-5.0
    

Alternatively, you can also install the Dotnet SDK using snap.

        sudo snap install dotnet-sdk
    

Learn More: How to Use Apt and Say Goodbye to Apt-get

Verifying the Installation

To check if .NET 5 has been installed successfully, you can run the following command to list available SDKs on your system. If you have multiple SDKs installed, they will all be listed here.

        dotnet --list-sdks
    
output listing dotnet sdks installed

As mentioned earlier, when you install the .NET 5 SDK, the .NET Runtime is included by default. Verify the Runtime installation using the following command.

        dotnet --list-runtimes
    

Developing Applications With .NET

Although .NET is easy to install and use, sometimes users bump into issues that are difficult to fix. In such situations, you can use the following command to learn more about the dotnet command and its options.

        dotnet --help
    

The various components in the .NET framework confuse a lot of developers. And before you start developing applications using the framework, knowing what .NET really is can be helpful.