How to Install .NET Core on Debian 10

Developing cross-platform applications on Linux is a task that we can do without problems with the help of .NET Core. This Microsoft framework is available for Debian and we can install it both to start a project and to run others. So, after reading this post, you will be able to install .NET Core on Debian 10.

.NET Core is an open-source, cross-platform, high-performance development platform for creating all types of applications. It is developed by Microsoft.

The main features of .NET Core are as follows:

  • It is cross-platform.
  • The app includes support for use with Docker containers.
  • It has been developed from scratch and high importance has been given to high performance.
  • Asynchrony with the use of async/await.
  • It is Open Source. So we can access the source code.

So if you are a software developer should take a look at it and know how to install it to apply it to your projects.

Install .NET Core on Debian 10

The installation of .NET Core on Debian is made easy thanks to the repository that Microsoft provides us. So this tutorial will be done in the terminal.

So, open a terminal from the main menu or by pressing the CTRL + ALT + T keys. Once it has run, then, update the entire distribution.

sudo apt update
sudo apt upgrade

To make the post and add the Microsoft repository, we have to install the apt-transport-https package

sudo apt install apt-transport-https

You probably already have it installed, but it is always good to make sure.

After that, we will have to download a DEB package provided by Microsoft to easily add its repository.

wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb
--2021-06-15 17:31:39--  https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb
Resolving packages.microsoft.com (packages.microsoft.com)... 104.214.230.139
Connecting to packages.microsoft.com (packages.microsoft.com)|104.214.230.139|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3124 (3.1K) [application/octet-stream]
Saving to: ‘packages-microsoft-prod.deb’

packages-microsoft-prod.deb                100%[=====================================================================================>]   3.05K  --.-KB/s    in 0s      

2021-06-15 17:31:40 (50.1 MB/s) - ‘packages-microsoft-prod.deb’ saved [3124/3124]

Now to add the repository just install this package.

sudo dpkg -i packages-microsoft-prod.deb
Selecting previously unselected package packages-microsoft-prod.
(Reading database ... 34251 files and directories currently installed.)
Preparing to unpack packages-microsoft-prod.deb ...
Unpacking packages-microsoft-prod (1.0-debian10.1) ...
Setting up packages-microsoft-prod (1.0-debian10.1) ...

Refresh the APT cache to make the packages available.

sudo apt update

And now we can perform the installation.

If you want to install the whole framework then run:

sudo apt install dotnet-sdk-3.1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  aspnetcore-runtime-3.1 aspnetcore-targeting-pack-3.1 dotnet-apphost-pack-3.1 dotnet-host dotnet-hostfxr-3.1 dotnet-runtime-3.1 dotnet-runtime-deps-3.1
  dotnet-targeting-pack-3.1 netstandard-targeting-pack-2.1
The following NEW packages will be installed:
  aspnetcore-runtime-3.1 aspnetcore-targeting-pack-3.1 dotnet-apphost-pack-3.1 dotnet-host dotnet-hostfxr-3.1 dotnet-runtime-3.1 dotnet-runtime-deps-3.1 dotnet-sdk-3.1
  dotnet-targeting-pack-3.1 netstandard-targeting-pack-2.1
0 upgraded, 10 newly installed, 0 to remove and 10 not upgraded.
Need to get 80.4 MB of archives.
After this operation, 342 MB of additional disk space will be used.
Do you want to continue? [Y/n]

If you only want to install enough runtime to run applications created with this framework then run:

sudo apt install dotnet-runtime-3.1

The choice is all yours.

In any case, you can now enjoy .NET Core on Debian 10.

Uninstall .NET Core on Debian 10

If you no longer wish to use .NET Core you can uninstall it from the system using the terminal.

To do this, run

sudo apt remove dotnet-sdk-3.1

If you installed only the runtime, then you can use this one.

sudo apt remove dotnet-runtime-3.1

After that, there will be no traces on the system.

Conclusion

Microsoft’s efforts to get closer to Linux are seen when it is possible to install one of their products on our system. This is the case of .NET Core whose installation, shown in this tutorial, can be done quickly and easily.

So with .NET you can start creating complex multiplatform and scalable projects.

Tell us about yourself, have you used it? what do you think? leave us a comment and share our post.

Scroll to Top