我正在尝试安装 .NET Core 包,但遇到问题并且不知道如何解决。
我按照此页面上的步骤操作,但收到以下错误:https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-2.1.202
我遵循整个指令,这是我的输出:
$ wget -q https://packages.microsoft.com/config/ubuntu/18/04/packages-microsoft-prod.deb
$ sudo dpkg -i packages-microsoft-prod.deb
(Reading database ... 293869 files and directories currently installed.)
Preparing to unpack packages-misrosoft-prod.deb ...
Unpacking packages-microsoft-prod (1.0-ubuntu18.04.1) over (1.0-ubuntu18.04.1) ...
Setting up packages-microsoft-prod (1.0-ubuntu18.04.1) ...
$ sudo add-apt repository universe
$ sudo apt-get install apt-transport-https
Reading package lists... Done
Building dependency tree
Reading state information... Done
apt-transport-https is already the newest version (1.6.6).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$ sudo apt-get update
Hit:1 http://mirror.ufscar.br/mariadb/repo/10.3/ubuntu bionic InRelease
Hit:2 https://repo.skype.com/deb stable InRelease
Hit:3 https://deb.nodesource.com/node_10.x bionic InRelease
Hit:4 https://dl.yarnpkg.com/debian stable InRelease
Hit:5 http://packages.microsoft.com/repos/vscode stable InRelease
Hit:6 https://dl.winehq.org/wine-builds/ubuntu bionic InRelease
Hit:7 https://dl.winehq.org/wine-builds/ubuntu artful InRelease
Hit:9 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:10 http://archive.canonical.com/ubuntu bionic InRelease
Ign:11 http://dl.google.com/linux/chrome/deb stable InRelease
Ign:12 http://packages.linuxmint.com tara InRelease
Hit:13 https://brave-browser-apt-release.s3.brave.com bionic InRelease
Hit:14 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:15 http://repository.spotify.com stable InRelease
Hit:16 http://packages.linuxmint.com tara Release
Hit:17 http://dl.google.com/linux/chrome/deb stable Release
Hit:18 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:21 http://security.ubuntu.com/ubuntu bionic-security Inrelease
Hit:8 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease
Reading package lists... Done
$ sudo apt-get install dotnet-sdk-2.1.202
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package dotnet-sdk-2.1.202
E: Couldn't find any package by glob 'dotnet-sdk-2.1.202'
E: Couldn't find any package by regex 'dotnet-sdk-2.1.202'
$
难道是我做错了什么?我的机器有问题吗?
答案1
这可能不是包的名称。如果您正在搜索一个包来使用该apt-cache search
命令,我建议您。
像这样的东西
sudo apt-cache search dotnet
这应该根据您安装的存储库找到描述或名称中包含“dotnet”的所有软件包。
答案2
我找到了解决办法,首先使用root安装。如果您使用Unbutun 18.04,您还需要预先添加此脚本:
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
add-apt-repository universe
apt-get install apt-transport-https
apt-get update
apt-get install dotnet-sdk-2.1.202
这是来源: