It’s a pleasure that .Net is available as open-source now. You can install and launch an application in the Linux cloud without any fuss. In this tutorial, I am going to demonstrate how to install the .Net 5 SDK and runtime on a Debian 10 Linux machine. I am using Debian 10 Buster Edition. All instructions and commands only apply to Debian 10.
Step 1. Fetch repositories
First of all, you would need to fetch repositories from Microsoft’s servers. Let’s do it.
Run the following commands in your terminal:
$ wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
$ sudo dpkg -i packages-microsoft-prod.deb
$ rm packages-microsoft-prod.deb
Step 2. Install the .Net SDK v5
Now you would need to install the SDK to develop your .NET applications locally.
$ sudo apt-get update;
$ sudo apt-get install -y apt-transport-https &&
$ sudo apt-get update &&
$ sudo apt-get install -y dotnet-sdk-5.0
Step 3. Install the runtime v5
Now install .NET 5 runtimes. This helps to run your application locally with an embedded server.
$ sudo apt-get install -y dotnet-runtime-5.0
When .NET is done installing, you will get the following message on your command line.
Microsoft collects some usage data and sends that data for research purposes. You can choose to disable it using system environment variables. It is your personal choice to keep telemetry running or not.
Step 4. Verify the installation
Now it is time to verify the installation. Simply run the following command to confirm that .NET has successfully installed and exists on your system. Refer the screenshot of my system as shown below:
$ dotnet --version
It will show you the latest version of .NET on your Debian CLI.
Step 5. Remove .NET v5
If you ever want to remove .NET from your system then you can choose to run the following simple apt commands to get rid of it:
$ sudo apt-get remove dotnet-sdk-5.0
$ sudo apt-get remove dotnet-runtime-5.0
These two commands are enough to remove .NET. However, Microsoft repositories will still exist on your system in case you want to install and run .NET again.
In this guide, we learned how to install .NET version 5. The given process is the simplest one. We have already published articles for other terminals using distributions. This install is only applicable for Debian 10 distribution. Got any questions? Ask here! I will be delighted to help.