3 Ways to install .NET 6 (dotnet) core on Debian 11 Bullseye

.NET (pronounced DOTNET ) is the most widely used software development platform to create and run programs for Windows. With .NET, Microsoft has not only created a consistent successor to the previous jumble of software development platforms for Windows, but also a real alternative to Java. Here we learn the commands to download and install .Net Core and Runtime on Debian 11 Bullseye.

Developers who are interested to develop and test their software for Windows computers can use Dotnet; along with several programming languages ​​such as C #, C ++, J#, Visual Basic, and others are supported so that as many programmers as possible can use the program.

.NET provides support for the programming paradigms:

Object orientation
Component orientation and
Service orientation

.Net 6 Core/SDK or Runtime installation on Debian 11 Bullseye LTS

#1st Method: Using Script

Download Dotnet Installation Script

Well, one of the easiest possible ways to start with Dotnet is to install it with the script officially provided by Microsoft. The user can use it to install both .Net SDK or Core and .Net Runtime.

sudo apt install wget

Get the Script

wget https://dot.net/v1/dotnet-install.sh

Make it executable:

chmod +x dotnet-install.sh

 

Install .Net Core SDK on Debian 11 Bullseye

.Net Core SDK includes all the all tools a developer is required to build and run .NET applications either using a command line or some graphical editor such as Visual Studio. Apart from Visual Studio support it also includes .NET Runtime; ASP.NET Core Runtime and .NET Desktop Runtime 6.0.1. While writing this tutorial the current long term version for open source .Net was 6, hence to get it you can simply type:

./dotnet-install.sh -c Current

The above command will download and install the latest version whatever is available via the Microsoft repository. Whereas the user who is looking for some particular one, replace the ‘Current’ in the above command with that.

For example, if you want to install version .Net version 5, the above command will be like:

./dotnet-install.sh -c 5.0

 

Note: The installation path will be “/home/$USER/.dotnet“. The $USER  is the one you used to run the above-given script. Also, you can add this path to your system variable to globally access the dotnet command line.

Note: Replace $USER with your current one:

echo 'export PATH="$PATH:/home/$USER/.dotnet/"' >> ~/.bashrc

Script to install .net runtime and sdk debian 11 buslleye

 

Install .Net Core RunTime on Debian 11:

If you don’t want the complete .Net Core SDK to develop applications and only seek for its Runtime environment to run the developed applications and abstract all the interaction with the base operating system; then instead of running the earlier command use the given ones.

ASP.NET Core Runtime allows to run existing web/server applications whereas for only dotnet runtime go for the second command:

./dotnet-install.sh -c Current --runtime aspnetcore

Only for .Net Runtime

./dotnet-install.sh -c Current --runtime dotnet

 

#2nd method using APT repository- The best one

If you don’t want to use the script to install Dotnet on Debian 11 Linux then another method is by adding the repository. This will give us an easy way to update .Net in the future by using the APT command.

Add .Net Repository

As I said if you want to get easily future updates for this Microsoft developing platform then add its repository manually. Here are the commands to follow:

Add the repo:

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

Run Update and also install tool for HTTPS support

sudo apt update
sudo apt install -y apt-transport-https

 

Apt command to install .Net Core SDK on Debian 11

Finally, we are done with the repository, now it’s time to simply use the APT package manager command for the installation of Microsoft dot net.

sudo apt install dotnet-sdk-6.0

Command to install .NET Dotnet SDK on Debian 11

Whereas for only Asp .Net Core runtime use:

sudo apt-get install aspnetcore-runtime-6.0

And for Only .Net Runtime, this one:

sudo apt-get install dotnet-runtime-6.0

 

Remove or Uninstall SDK (optional)

To remove SDK using APT run:

sudo apt remove dotnet-sdk-6.0

 

#3rd way: Install using SNAP

Enable SNAP

Well, if you are interested in SNAP, then here it is. However, first, we have to install and enable the SNAP on Debian 11 Bullseye because unlike Ubuntu it is not available pre-installed.

sudo apt install snapd
sudo snap install core

Start and enable, its service:

sudo systemctl start snapd
sudo systemctl enable snapd
sudo systemctl status snapd

 

Use Snap to install Dotnet

Next to install the complete .Net SDK using snap go for the given command:

sudo snap install dotnet-sdk --classic --channel=6.0

To access its command line without mentioning the SDK version, set alias:

sudo snap alias dotnet-sdk.dotnet dotnet

 

To uninstall (optional):

sudo snap remove dotnet-sdk --classic --channel=6.0

 

Other Tutorials:

12 Best Linux Distros for Everyday Use
Download CentOS Stream 9 ISO or Cloud
4 Ways to install VS Code Editor on Ubuntu or Debian

 

 

Leave a Comment

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