Home  »  ArticlesGuidesHow ToLibrariesTechnologyTools   »   How to Install .NET Core SDK and Runtime on Ubuntu 20.04 | 18.04

How to Install .NET Core SDK and Runtime on Ubuntu 20.04 | 18.04

This quick tutorial will show you how to install .NET Core SDK and Runtime on Ubuntu 20.04 or older systems using the command-line interface.

.NET Core is a free and open-source, managed computer software framework for Windows, Linux, and macOS operating systems developed by Microsoft employees via the .NET Foundation. It is a cross-platform successor to .NET Framework.

As of .NET Core has been rebranded to .NET starting from version 5. The .NET framework supports the use of NuGet packages as opposed to the .NET Framework, which is serviced using Windows Update.

Step 1: Setup PPA

The Microsoft team provides and Debian packages to create PPA on Ubuntu systems. Run the following command in your terminal to download the Debian package and install it on your system.

$ 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

For Ubuntu 18.08 download this package instead of in the first step above:

$ wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

Step 2: Install .NET Core SDK on Ubuntu

Run the following commands to update your apt-cache and to install the .NET SDK. The current version as of this writing is .NET 5.0

$ sudo apt update
$ sudo apt install -y apt-transport-https
$ sudo apt update
$ sudo apt install -y dotnet-sdk-5.0

Step 3: Install ASP.NET Core Runtime on Ubuntu

The ASP.NET Core Runtime allows you to run apps that were made with .NET that didn’t provide the runtime. Run the following commands install the ASP.NET Core Runtime.

$ sudo apt update
$ sudo apt install -y apt-transport-https
$ sudo apt update
$ sudo apt install -y aspnetcore-runtime-5.0

As an alternative to the ASP.NET Core Runtime, you can install the .NET Runtime, which doesn’t include ASP.NET Core support by replacing aspnetcore-runtime-5.0 in the previous command with dotnet-runtime-5.0:

$ sudo apt install -y dotnet-runtime-5.0

Conclusion

You have seen how easy it is to install .NET Core SDK and the Runtime options in Ubuntu 20.04 and 18.04.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.