Skip to content

How to Install Dotnet Core on Ubuntu 20.04

Use this tutorial to install dotnet core on Ubuntu 20.04 Linux system. Installing .net core runtime on Ubuntu Linux via PPA. Ubuntu Install dotnet core

Steps
5
Category
Programming
Covers
.NET, Ubuntu
Versions & support
About .NET →, About Ubuntu →
On this page 5 steps

The .NET Core is a free and open-source software framework designed with keeping Linux and macOS in mind. It is a cross-platform successor to .NET Framework available for Linux, macOS and Windows systems. .NET Core framework already provides scaffolding tools for bootstrapping projects.

This tutorial is an walk through to install dotnet core on Ubuntu 20.04 LTS Linux system. Also created a sample application using dotnet core.

Step 1 of 5Enable Microsoft PPA

First of all, enable Microsoft packages repository on your Ubuntu system. The Microsoft official team provides a debian packages to setup PPA on your system.

Open a terminal on your Ubuntu system and configure Microsoft PPA by run the following commands:

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb 
sudo dpkg -i packages-microsoft-prod.deb 

Step 2 of 5Installing Dotnet Core SDK

.NET Core SDK is the Software development kit used for developing applications. If you are going to create a application or making changes to existing application, you will required .net core sdk package on your system.

To install .NET Core SDK on Ubuntu 20.04 LTS system, execute the commands:

sudo apt update 
sudo apt install apt-transport-https 
sudo apt install dotnet-sdk-3.1 

To install the previous version of .Net Core SDK 2.1, type:

sudo apt install dotnet-sdk-2.1

Press “y” for any input prompted by the installer.

That’s it. You have successfully install .Net core SDK on your Ubuntu system.

Step 3 of 5Install Dotnet Core Runtime Only

.NET Core Runtime is required for the system, where you only need to run application. For example, production or stating environments are required to run applications only.

To install .NET Core Runtime on Ubuntu 20.04 LTS system, execute the commands:

sudo apt update 
sudo apt install apt-transport-https 
sudo apt install dotnet-runtime-3.1 

To install the previous version of .Net core runtime 2.1, type:

sudo apt install dotnet-runtime-2.1

Press “y” for any input prompted by the installer.

That’s it. You have successfully install .Net core runtime on your Ubuntu system.

Step 4 of 5(Optional) Check .NET Core Version

You can use dotnet command line utility to check installed version of .NET Core on your system. To check dotnet version, type:

dotnet --version

3.1.401

Step 5 of 5Create Sample Application

Let’s create a sample application with dotnet core on your Ubuntu system. Create a new console application with the command:

dotnet new console -o HelloWorld

The Above command will create dotnet application on your system. This will create a directory named “helloworld” in under the current directory. You can change to this directory and start working your application.

cd  HelloWorld

Make your changes to application and execute below command to run this application.

dotnet run

You will see the below output on terminal. 3

dotnet core hello world example

Conclusion

In this tutorial, you have learned to install .NET Core SDK and Runtime on a Ubuntu 20.04 LTS (Focal Fossa) Linux system.

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

10 Comments

    1. Hi Mervin,

      I hope the application build on .net core 3.0 should be compatible with .netcore 3.1. Are you facing any error if run app with 3.1?

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top