无法在 Ubuntu Bionic Beaver 上安装 .NET Core

无法在 Ubuntu Bionic Beaver 上安装 .NET Core

我目前正在尝试在 Ubuntu 18.04 上安装 .NET Core,如下所示这些说明。但我总是收到以下消息:

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.

我找到了一些关于这个问题的帖子,但没有帮助。我希望在这里得到一些正确的信息。

答案1

首先添加来源:

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 apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.1.200

sudo apt-get 更新很重要

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

答案2

安装后libicu55,您需要安装其他无法自行安装的软件包依赖项:

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

然后sudo apt=get install dotnet-sdk-2.x

答案3

注册 Microsoft 密钥和订阅源

在安装 .NET 之前,您需要注册 Microsoft 密钥、注册产品存储库并安装所需的依赖项。每台机器只需执行一次。

打开终端并运行以下命令:

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

安装 .NET SDK

更新可供安装的产品,然后安装 .NET SDK。

在终端中运行以下命令:

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

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

答案4

您需要安装 libicu55:

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

然后安装网络核心:

sudo apt-get install dotnet-sdk-2.1

相关内容