The .NET COre is and free and open-source software development framework for Windows, Android, macOS, and Linux. This cross-platform tool is used for creating gaming, desktops, Internet of Things(IoT), cloud-native, console, Machine learning applications e.t.c. This project was developed by Microsoft via the .NET Foundation and released under the MIT and Apache 2 licenses.
.NET lets your code look easy and the same no matter the type of application you are building since you have access to the same API, runtime, language capabilities e.t.c. It consists of Integrated Development Environments(IDEs) that include; GitHub Codespaces, Visual Studio for Mac, Visual Studio Code, and Visual Studio.
The latest release, .NET Core 6, comes with the following new features:
- Supported for three years as the latest long term support (LTS) release.
- Improved performance -.NET 6 is the fastest full stack web framework, which lowers compute costs if you’re running in the cloud. Performance is boosted with Profile-guided optimization, fileStream and Crossgen2
- Simplified development – Getting started is easy. New language features in C# 10 reduce the amount of code you need to write. And investments in the web stack and minimal APIs make it easy to quickly write smaller, faster microservices.
- Ultimate productivity – .NET 6 and Visual Studio 2022 provide hot reload, new git tooling, intelligent code editing, robust diagnostics and testing tools, and better team collaboration.
- Arm64 support – this release includes support for macOS Arm64 and Windows Arm64 operating systems
- Hot reload – this lets you modify the app’s source code and instantly apply those changes to your running app. This avoids in between restarts when editing a code.
- Visual Basic has improvements in the Visual Studio experience and for Windows Forms project open experience.
- JSON APIs are more capable and have higher performance with a source generator for the serializer.
- Security improvements – with support for OpenSSL 3, the ChaCha20Poly1305 encryption scheme, and runtime defense-in-depth mitigations, specifically W^X and CET.
- Unified platform across browser, cloud, desktop, IoT, and mobile apps, all using the same .NET Libraries and the ability to share code easily.
This guide aims to demonstrate how to install and use .NET Core 6 on Debian 12 / Debian 11.
Step 1 – Install .NET Core 6 on Debian 12 / Debian 11
In this guide, I will demonstrate several methods to install .NET Core 6 on Debian 12 / Debian 11 namely:
- Using APT
- Using Snap
- Using a Script
Method 1 – Install .NET Core 6 on Debian 12 / Debian 11 using APT
For this method, you need to add the Microsoft package signing key to the trusted keys list.
##On Debian 12
wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo apt install ./packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
##On Debian 11
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
Once the repository has been added, install the .NET SDK which allows you to develop apps with .NET as below.
sudo apt update -y
sudo apt install -y apt-transport-https
sudo apt-get install -y dotnet-sdk-6.0
Also, install the ASP.NET Core Runtime that will allow you to run apps that are created with .NET.
sudo apt update
sudo apt install -y apt-transport-https
sudo apt-get install -y aspnetcore-runtime-6.0
As an alternative to the ASP.NET Core Runtime, you can install the dotnet-runtime-6.0 as below.
sudo apt update
sudo apt install -y apt-transport-https
sudo apt-get install -y dotnet-runtime-6.0
Method 2 – Install .NET Core 6 on Debian 12 / Debian 11 using Snap
The SDK and .NET Runtime are available as snaps. Before we install them, ensure that snap is installed and running on Debian 12 / Debian 11.
Install Snapd as below:
sudo apt install snapd
Start and enable Snapd.
sudo systemctl enable --now snapd.socket
sudo systemctl enable --now snapd apparmor
Once Snapd is installed, the .NET Core 6 can be installed as below.
- Install the SDK
$ sudo snap install dotnet-sdk --classic --channel=6.0
2022-01-11T10:20:43-05:00 INFO Waiting for automatic snapd restart...
dotnet-sdk (6.0/stable) 6.0.101 from Microsoft .NET Core (dotnetcore✓) installed
Once installed, register the dot net using the snap alias
command
sudo snap alias dotnet-sdk.dotnet dotnet
- Install the runtime
$ sudo snap install dotnet-runtime-60 --classic
Warning: flag --classic ignored for strictly confined snap dotnet-runtime-60
dotnet-runtime-60 6.0.1 from Microsoft .NET Core (dotnetcore✓) installed
Also, register the dotnet command as below.
sudo snap alias dotnet-runtime-60.dotnet dotnet
Now export the install location as below.
$ vim ~/.bashrc
export DOTNET_ROOT=/snap/dotnet-sdk/current
Source the profile.
source ~/.bashrc
Method 3 – Install .NET Core 6 on Debian 12 / Debian 11 with Script
Here, we will use the dotnet-install scripts used for automated installations for the SDK and runtime. Download the script as below:
wget https://dot.net/v1/dotnet-install.sh
Once downloaded, make it executable as below.
chmod +x dotnet-install.sh
Now with the script, we will install .NET Core 6 as below.
$ ./dotnet-install.sh -c 6.0
Once the installation is complete, export the PATH Environment.
$ vim ~/.bashrc
export PATH=$PATH:$HOME/.dotnet
export DOTNET_ROOT=$HOME/.dotnet
Source the profile.
source ~/.bashrc
Step 2 – Enable TAB completion for the .NET CLI
This guide demonstrates how to set TAB completion for the .NET CLI with Bash and Zsh. Once configured, the .NET CLI is triggered by typing a dotnet command then pressing the TAB key.
For Bash, you will be required to add the below lines to .bashrc
$ vim ~/.bashrc
# bash parameter completion for the dotnet CLI
_dotnet_bash_complete()
{
local word=${COMP_WORDS[COMP_CWORD]}
local completions
completions="$(dotnet complete --position "${COMP_POINT}" "${COMP_LINE}" 2>/dev/null)"
if [ $? -ne 0 ]; then
completions=""
fi
COMPREPLY=( $(compgen -W "$completions" -- "$word") )
}
complete -f -F _dotnet_bash_complete dotnet
Once complete, source the bashrc file as below.
source ~/.bashrc
For Zsh, add the below lines to the .zshrc file.
$ vim ~/.zshrc
# zsh parameter completion for the dotnet CLI
_dotnet_zsh_complete()
{
local completions=("$(dotnet complete "$words")")
reply=( "${(ps:\n:)completions}" )
}
compctl -K _dotnet_zsh_complete dotnet
Source the Zsh file.
source ~/.zshrc
Step 3 – Get started with .NET on Debian Linux
Now open the terminal and create a sample application using .NET as below.
dotnet new console --output sample1
Sample Output:
Welcome to .NET 6.0!
---------------------
SDK Version: 6.0.428
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
----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
The template "Console App" was created successfully.
Processing post-creation actions...
Running 'dotnet restore' on /home/cloudspinx/sample1/sample1.csproj...
Determining projects to restore...
Restored /home/cloudspinx/sample1/sample1.csproj (in 75 ms).
Restore succeeded.
Now run the project.
dotnet run --project sample1
Sample Output:

Voila!
From the output above, we are safe to conclude that the .NET Core 6 installation on Debian 12 / Debian 11 is working correctly.
That marks the end of this guide. I hope you found it significant.
See more: