How to Install .NET Core (dotnet) on Ubuntu 22.04

Microsoft .NET Core is a free and open-source software framework. NET Core is the modular and high-performance implementation of .NET for creating web, Windows Mobile, and Windows applications. The Ubuntu 22.04 users can only install .NET Core 6.0. It doesn’t support .NET Core 3.1 or 2.0 since the distro only supports OpenSSL 3.

Useful Article:

In this article, I will show you how to install and start with .NET Core on Ubuntu systems.

Step 1: Adding Microsoft Package Repository:

First, enable the Microsoft Apt repository on our Ubuntu systems It does not have .NET Core packages in the official package repository.

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

Step 2: Installing .NET Core SDK

.Net core SDK package is required If you want to create an application or make changes to an existing application.

We are done with the Microsoft PPA repository, now it’s time to simply use the APT command for the installation of Microsoft dotnet.

$ sudo apt update 
$ sudo apt install dotnet-sdk-6.0

Step 3: Installing .NET Core Runtime

.NET Core Runtime is required for the system, where you only need to run the application. Use the apt command to install the .NET Core runtime.

$ sudo apt update 
$ sudo apt install dotnet-sdk-6.0

Step 4: Check the .NET Core Version

Now, to check the .NET Core SDK version, run the following command:

$ dotnet --version

Step 5: Create a Sample Application

Now, we will create a new dotnet sample application on the Ubuntu system. Create a new console application with the command:

$ mkdir Project
$ cd Project
$ dotnet new console -o Techworld

This will create a .Net core application. To run the application run the below command.

$ cd Project
$ dotnet run

You will see the following output.

Enjoy it!

No Responses

Leave a Reply

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.