How to install dotnet 6 to Ubuntu?

Alper Ebiçoğlu
1 min readNov 21, 2021

--

Let’s install dotnet-sdkand dotnet-runtime to Ubuntu operating system.

There are several ways that you can install it. I’ll explain some of them.

WAY #1: Snap package

1- Use the snap install command to install dotnet-sdk snap package.

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

You will see the following message if it’s successful:

dotnet-sdk (6.0/stable) 6.0.100 from Microsoft .NET Core (dotnetcore✓) installed

2- Install dotnet-runtime snap package.

sudo snap install dotnet-runtime-60 --classic
sudo snap alias dotnet-runtime-60.dotnet dotnet

3- Export the install location

export DOTNET_ROOT=/snap/dotnet-sdk/current

Now check that if it’s installed:

sudo dotnet --info

Reference: https://docs.microsoft.com/en-us/dotnet/core/install/linux-snap

WAY #2: Scripted install

This is mostly used for CI systems. Also if you don’t like to run dotnet commands with always sudoprefix then this is the way you go.

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

Reference: https://docs.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install

WAY #3: apt install

sudo add-apt-repository universe
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-6.0

Note that, you can also download it and manually install the SDK and runtime. See this article.

I’m Alper Ebicoglu 🧑🏽‍💻 ABP Framework Core Team Member
Follow me for the latest news about .NET and software development:
📌 twitter.com/alperebicoglu
📌 github.com/ebicoglu
📌 linkedin.com/in/ebicoglu
📌 medium.com/@alperonline

--

--