Zhixian's Tech Blog

2018-12-08

Install .NET Core 2.2 on Ubuntu 18.04

Filed under: computing, ubuntu, Uncategorized — Tags: , , — Zhixian @ 09:40:12 am

About

This is a note to self about installing the .NET Core SDK 2.2 on Ubuntu (because the instructions on Microsoft website does not work / is incomplete).

Scenario

When the .NET Core 2.2 SDK release was announced, I was keen to install it on my Ubuntu machine. So I went to their web site (https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-2.2.100) and and followed their instructions there.

The instructions are:

  1. Register Microsoft feed
  2. Install the .NET SDK

Which means executing the following commands at your command-line prompt:

wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo add-apt-repository universe
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.2

Unfortunately, despite following the instructions, you may find that you still could not install the latest .NET Core SDK as the package could not be found when you execute the last command! 😦

Solution

To fix this issue, you need to add Microsoft’s repository:

sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update

After update, you should be able install .NET Core 2.2 SDK by running the following command again.

sudo apt-get install dotnet-sdk-2.2
Advertisements

Create a free website or blog at WordPress.com.