Cannot install .NET Core on Ubuntu Bionic Beaver

I'm currently trying to install .NET Core on Ubuntu 18.04 following these instructions. But I always get the following message:

me@mine-Ubuntu:~$ sudo apt-get install -y dotnet-sdk-2.1.200
[sudo] password for me: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 dotnet-sdk-2.1.200 : Depends: dotnet-runtime-2.0.7 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I've found some posts about this issue but no help. I hope to get some proper information here.

Answers 4

  • After installing libicu55, you need to install the other package dependencies that won't install on their own:

    sudo apt-get install dotnet-runtime-deps-2.2
    sudo apt-get install dotnet-runtime-2.2
    sudo apt-get install aspnetcore-runtime-2.2
    

    Then sudo apt=get install dotnet-sdk-2.x


  • first add the sources:

    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/ubuntu/18.04/prod.list 
    sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
    

    after that:

    sudo apt-get install apt-transport-https
    sudo apt-get update
    sudo apt-get install dotnet-sdk-2.1.200
    

    sudo apt-get update is important

    source: https://www.microsoft.com/net/learn/get-started/linux/ubuntu18-04


  • Register Microsoft key and feed

    Before installing .NET, you'll need to register the Microsoft key, register the product repository, and install required dependencies. This only needs to be done once per machine.

    Open a terminal and run the following commands:

    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/ubuntu/18.04/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
    

    Install .NET SDK

    Update the products available for installation, then install the .NET SDK.

    In your terminal, run the following commands:

    sudo apt-get install apt-transport-https
    sudo apt-get update
    sudo apt-get install dotnet-sdk-2.1
    

    Source - https://www.microsoft.com/net/download/linux-package-manager/rhel/sdk-current


  • You need to install libicu55:

    sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
    sudo apt-get update
    sudo apt-get install libicu55
    

    And then install net core:

    sudo apt-get install dotnet-sdk-2.1