Introduction
With the release of Debian 11, developers are going through multiple changes and updates. I am writing this guide to show that you have a robust dot Net Framework running on your computer. Either you installed .Net 5 on a previous edition of Debian or it was the beta version of .Net 6, this article will cover all the aspects for our Debian community.
I would recommend that you begin from the first step and go thoroughly to the last. This will help you to avoid making mistakes while developing .net applications. As .Net SDK and runtime are not available in Debian repositories. Therefore, we need to make sure that we use the right repositories to install and upgrade the SDK on our system. I am using Debian 11, and all the instructions apply to Debian 11 only. You must not use Ubuntu PPAs to install or update the SDK.
Dependency Requirements For .Net SDK
The .Net SDK does not need any external dependencies. All the dependencies are bundled within the single installer itself.
Step 1. Add the .Net SDK Keys on Debian
This should always be in your mind that you need to update your system first to avoid any issues. Following commands are required to update the Debian.
$ sudo apt update
$ sudo apt dist-upgrade
The Debian system will be ready to install .Net once the core operating system is updated and upgraded. Now add the security keys using the below commands.
$ wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
$ sudo dpkg -i packages-microsoft-prod.deb
$ rm packages-microsoft-prod.deb
As soon as you run these commands, all the related repositories will be available for you.
Step 2. Install the .Net SDK 6
Now we will perform the installation using the following commands.
$ sudo apt-get update
$ sudo apt-get install -y apt-transport-https
$ sudo apt-get update
$ sudo apt-get install -y dotnet-sdk-6.0
Step 3. Install the .Net Runtime
The .Net SDK will be useless without .Net runtime. Use the following commands to install the runtime.
$ sudo apt-get update
$ sudo apt-get install -y apt-transport-https
$ sudo apt-get update
$ sudo apt-get install -y aspnetcore-runtime-6.0
Step 4. Verify the Installation of .Net 6
Now we will verify the installation of .Net 6 on the Debian 11 system. It is simple to check the existence of the software.
$ dotnet --version
Step 5. How to Remove the .Net from Debian
In our case, it is simple to remove the dot Net from our system. Use the following command and you are ready to remove the .Net packages.
$ sudo apt remove dotnet-sdk-6.0
Conclusion
It was simple to install both .Net SDK and Runtime on Debian. I hope you had a good experience.