How to Install .NET 5 on Ubuntu 18.04 | 20.04

How to Install .NET 5 on Ubuntu 18.04 20.04

In this post, we are going to show that how to Install Microsoft .NET 5 on Ubuntu 18.04 | 20.04. If your are going to Install .NET 5 on your Ubuntu then this post is ideal for you.

.NET 5 is a cross-platform and open source developer platform that is used to develop different types of applications. With the help of it, you can also use multiple languages(C#, F#, or Visual Basic), editors, and libraries to develop for web, mobile and desktop applications.

For more details about .NET 5, please visit its official website.


How to Install .NET 5 on Ubuntu

Simply follow below steps to install .NET 5 on your Ubuntu:

Step 1 : Prepare Ubuntu and Install Required Packages

Before install .NET 5, you will need to update your system to the latest stable version and install some basic required packages (apt-transport-https) using commands below:

sudo apt update
sudo apt install apt-transport-https

Step 2 : Add .NET Repository

Next, run the command below to add Microsoft’s package repository to your Ubuntu 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

Step 3 : Install .NET 5 SDK

After adding Microsoft’s package repository in your system, you can install .NET using command below:

sudo apt update
sudo apt install dotnet-sdk-5.0

The command above will display a success message similar like 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 Telemetry
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.
Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry Configuring…
A command is running to populate your local package cache to improve restore speed and enable offline access. This command takes up to one minute to complete and only runs once.

You can verify .NET is installation using command below:

dotnet --list-sdks

The command above will display a output similar like below:

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

You can also verify .NET runtime using command below:

dotnet --list-runtimes

It will display a output similar like below:

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

Step 4 : Install .NET 5 via Snap

Snap is a cross-distribution software deployment and package management system. Snap packages are safe to install and run, they auto-update and we can also roll-back the changes easily.

If Snap is not installed on your system then you will need to install it before you install .NET 5. Installing via snap is the best and easiest way to install packages on Linux machine, including Ubuntu.

To Install snap package manager , run the commands below :

sudo apt update
sudo apt install snapd

Now, run the command below to install .NET 5:

sudo snap install dotnet-sdk --classic

That’s all.

If you face any error and issue in above steps , please use comment box below to report.

If our tutorials helped you, please consider buying us a coffee. We appreciate your support!

Thank you for your support.

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top