Installing DotNet SDK binaries in Ubuntu Box - Dabian Way - DevDummy

Latest

Views | Thoughts | Concepts | Techniques

Wednesday, December 12, 2018

Installing DotNet SDK binaries in Ubuntu Box - Dabian Way

Recently I wanted to install DotNet SDK in a Ubuntu box. While searching the possibilities, I noticed that there are two ways to follow, the Ubuntu version specific way and the inherited Debian Way !

Having the faith in roots, I started using the Debian way which seems to be compatible with all Ubuntu versions.

First we need to update the Ubuntu repo indexes registering Microsoft product repository as they are not included in default Ubuntu configs. This includes registering the Microsoft key as well.

Register Microsoft key with Repository Index

$ wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
$ sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
$ wget -q https://packages.microsoft.com/config/debian/9/prod.list
$ sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
$ sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
$ sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list

Update Ubuntu Package Manager

$ sudo apt-get update

As the new repo indexes are being added, the update will now fetch the packages from Microsoft site as well. 
Additionally you may need to install the https support packages,

$ sudo apt-get install apt-transport-https

Install the required .NET SDK

sudo apt-get install dotnet-sdk-2.2

Welcome to .NET Core!
---------------------
Learn more about .NET Core: https://aka.ms/dotnet-docs

Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs

This works perfectly,


$ dotnet --version