How to install .NET Core on Ubuntu!

Created September 18, 2021

What is .NET?

.NET Core is a new version of .NET Framework, which is a free, open-source, general-purpose development platform maintained by Microsoft. It is a cross-platform framework that runs on Windows, macOS, and Linux operating systems. .NET Core Framework can be used to build different types of applications such as mobile, desktop, web, cloud, IoT, machine learning, microservices, game, etc.


Installation

Step 1. Enable 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. Installing 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. Install 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. (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

Output

3.1.413