How to Install .NET Core (dotnet) SDK on Ubuntu Linux

The post instructs on installing and using Microsoft .NET Core SDK on Ubuntu Linux; an open-source, cross-platform framework. The current stable version is 6.0, supported for 3 years. Instructions detail how to install the .NET Runtime included SDK and verify its installation, either via HTTPS or Snap, both methods ensuring ease of .NET apps development.…

This post shows students and new users how to install and use Microsoft .NET Core (dotnet) SDK on Ubuntu Linux. Microsoft .NET core SDK is a cross-platform, open-source framework that supports Linux and Mac OS systems.

The current stable version of .NET core is 6, a Long Term Support (LTS) version that will be supported for 3 years and comes with better git integration with Visual Studio 2022.

If you are a developer and want to build .NET apps, the best way to do it on Ubuntu Linux is to install the Software Development Kit (SDK), which includes the .NET Runtime by default.

This will allow you to develop and run .NET Framework applications in Ubuntu Linux.

How to install dotnet (.NET) SDK on Ubuntu Linux

As mentioned above, Microsoft .NET core SDK is a cross-platform, open-source framework that supports Linux and Mac OS systems.

Below is how to install it on Ubuntu Linux.

Before installing .NET core SDK, you want to install some essential packages. This package allows you to install the .NET SDK securely via HTTPS.

To do that, install the apt-transport-HTTP package using the command below.

sudo apt update
sudo apt install apt-transport-https

Add .NET Repository

After installing the package, run the command below to add Microsoft’s package repository to your system.

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

The lines above create a /etc/apt/sources.list.d/microsoft-prod. Next, list the repository file on your Ubuntu Linux system with appropriate config settings.

If you’re using a different version of Ubuntu Linux, replace the highlighted version number in the commands above.

Install .NET Core SDK on Ubuntu Linux

Now that a repository is created, run the commands below to install the version of .NET SDK for your system. As of this writing, the current version is 6.0.

sudo apt update
sudo apt install dotnet-sdk-6.0

After installing, you should get a success message similar to the one below:

Welcome to .NET!
---------------------
Learn more about .NET: https://aka.ms/dotnet-docs
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs

Once .NET SDK is installed, you can verify by running the commands below.

dotnet --list-sdks

The command above will display the version of .NET installed.

Output:
6.0.300 [/usr/share/dotnet/sdk]

Also, verify that the .NET runtime is functioning.

dotnet --list-runtimes

That should display similar lines as shown below:

Output:
Microsoft.AspNetCore.App 6.0.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

The commands below can also be used to install .NET Framework independently.

sudo apt install dotnet-runtime-6.0 

How to install .NET Core SDK on Ubuntu via Snap

Alternatively, one can install .NET Core SDK via Snap package management. Some people prefer installing .NET SDK via Snap as it might be the quickest and easiest.

Snaps are containerized software packages that are simple to create and install.

Snap applications are packaged with all their dependencies to run on all popular Linux distributions from a single build, allowing them to update automatically and roll back gracefully.

To install .NET via snap, run the commands below:

sudo apt install snap 
sudo snap install dotnet-sdk --classic

After installing, you can begin building great applications.

That should do it!

Conclusion:

  • Microsoft .NET Core SDK is a versatile, cross-platform framework supporting Linux and Mac OS systems, including Ubuntu Linux.
  • With the ability to install the SDK via the Software Development Kit (SDK), along with the .NET Runtime, developers can seamlessly build and run .NET applications on Ubuntu Linux.
  • Users have the option to install the .NET Core SDK either through traditional package management or via the Snap package, providing flexibility and convenience.
  • The Long Term Support (LTS) version 6.0 of .NET Core SDK, supported for 3 years, features improved git integration with Visual Studio 2022, enhancing the development experience on Ubuntu Linux.
Richard Avatar

Comments

Leave a Reply

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


Exit mobile version