How to Setup .Net Core in Ubuntu 20.04

How to Setup .Net Core in Ubuntu 20.04

Historically, .Net technologies were mainly associated with Windows platforms, desktops, and servers. With the release of .Net Core, Microsoft has extended the availability to all platforms running MacOs and different distributions of Linux, e.g., OpenSuse, CentOS, Debian, and others. The benefits of running .Net Core on other platforms extend way beyond just the availability. Developers running other operating systems can now use the methods and tools available in .Net Core to achieve their objectives. When working with Ubuntu 20.04, you have to work with the terminal and execute a couple of commands to deploy .Net Core. In this post, I will walk you through everything you’ll need.

Enabling Microsoft PPA

First off, you need to enable the Microsoft Personal Package Archive (PPA) in your Ubuntu Installation. Microsoft’s official team supports the PPA. You can enable it using these commands in your terminal:

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

You’ll see the following output

Now execute this:

$sudo dpkg -I packages-microsoft-prod.deb

When you see the following output, you’ll be ready to proceed:

Installing the SDK

An SDK (Software Development Kit) is the base used for developing applications using a certain framework. If you want to create and edit .Net applications on Ubuntu, you need to install the .Net Core SDK. In order to begin installing the .Net Core SDK, your system needs the latest updates.

If you know that it doesn’t have these updates, you can run the following command to get the update:

$sudo apt update

Once this is done, you need to install this pre-req:

$sudo apt install apt-transport-https

Once the pre-req is completely installed, you can finally install the SDK through the following:

$sudo apt install dotnet-sdk-[x]

The x at the end of the last command specifies the .Net Core SDK version. If you want to target a specific SDK or an older version, you can change this number to target that specific SDK, e.g.:

$sudo apt install dotnet-sdk-1.1

This will install the SDK on your machine, and now you are ready to create and edit .Net applications on Ubuntu.

Installing the Runtime

A runtime is the intermediary that runs the applications that you create. Earlier you needed to install the .Net Runtime separately through the following:

$sudo apt install dotnet-runtime-3.1

With the recent updates to the packages, if you run this command, you’ll get to know that it is already installed:

With this, you are ready to hit the ground running and start rocking .Net Core on Ubuntu.

Creating your test application

With all of the pieces in place, let’s create a test application to make sure that everything is working right. We’ll say Hello to the world of programming by creating a console application:

$dotnet new console -o HelloWorld

This output means that your application has been created. Now navigate into that directory and run using:

$dotnet run

With this output, you can be assured that everything is set up accurately and you are ready to start creating .Net applications in Ubuntu 20.04.


By following the commands and steps given above, you should be able to get started without much hassle. If you want instructions for another Linux distribution or if you want to discuss any of the steps above, drop a comment below, and let’s talk.

Similar Posts