Setup .Net Core in Ubuntu 20.04 - A step by step guide ?

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.

Basically, the .NET Core is a free and open-source software framework designed with keeping Linux and macOS in mind. It provides scaffolding tools for bootstrapping projects.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Linux system queries.

In this context, we shall look into How to Install  and setup Dotnet Core on Ubuntu 20.04.

Steps to install .Net Core in Ubuntu

1. Enable Microsoft PPA

To begin, 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 

Next, execute the below command:

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

2. Install the .Net 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.

3. Install .Net Runtime

A runtime is the intermediary that runs the applications that you create. You can install the .Net Runtime separately through the following:

$ sudo apt install dotnet-runtime-3.1

4. Create your test application

Now. 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

Next, navigate into that directory and run using:

$ dotnet run

[Need assistance in installing any Software on Ubuntu Linux system ? We can help you. ]


This article covers a step by step procedure on how to install dotnet core on Ubuntu 20.04 LTS Linux system.