[英]How to install dotnet SDK on Ubuntu 16.04 LTS
I have been following the instructions provided here: https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x我一直在遵循此处提供的说明: https : //docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x
However, I keep getting the error when I try to run"但是,当我尝试运行时,我不断收到错误消息”
sudo apt-get install dotnet-sdk-2.1.4
Specifically it says:具体说:
E: Unable to locate package dotnet-sdk-2.1.4
E: 无法定位软件包 dotnet-sdk-2.1.4
E: Couldn't find any package by glob 'dotnet-sdk-2.1.4'E: 无法通过 glob 'dotnet-sdk-2.1.4' 找到任何包
E: Couldn't find any package by regex 'dotnet-sdk-2.1.4'E: 无法通过正则表达式“dotnet-sdk-2.1.4”找到任何包
However, doing a sudo apt search dotnet
results in the package showing up.但是,执行
sudo apt search dotnet
导致显示包。
Am I doing something wrong?我做错了什么吗?
Try running this command on your terminal:尝试在终端上运行此命令:
wget -q packages-microsoft-prod.deb https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
Then update your system:然后更新您的系统:
sudo apt-get update
Finally, run the command to install .NET最后,运行命令安装.NET
sudo apt-get install dotnet-sdk-2.1.4
Hope that helps!希望有帮助!
Ensure you're running the prerequisite commands also:确保您还运行先决条件命令:
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
And finally:最后:
sudo apt-get update
sudo apt-get install dotnet-sdk-2.1.4
Looks as if the deb package to set up the apt repo has some issues.看起来好像用于设置 apt 存储库的 deb 包有一些问题。 As a quick fix do after installing the ms repo setup package:
作为安装 ms repo 安装包后的快速修复:
sudo cp \
/etc/apt/sources.list.d/microsoft-prod.list.save \
/etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update
sudo apt-get install dotnet-sdk-2.1
Fix worked on ubuntu 18.04 but seems to be the same issue here.修复在 ubuntu 18.04 上工作,但在这里似乎是同样的问题。
One reason why apt is unable to locate the packages is that they are not available for your processor architecture. apt 无法定位软件包的原因之一是它们不适用于您的处理器架构。 The dotnet core Linux libraries do not support the 32-bit PC (i386, i686), only the 64-bit PC (amd64) are supported.
dotnet core Linux 库不支持 32 位 PC(i386、i686),仅支持 64 位 PC(amd64)。 If you happen to have a Ubuntu install of a different architecture, apt-get will report the aforementioned error:
如果您碰巧安装了不同架构的 Ubuntu,apt-get 将报告上述错误:
Unable to locate package dotnet-sdk-2.2
E: Couldn't find any package by glob 'dotnet-sdk-2.2'
E: Couldn't find any package by regex 'dotnet-sdk-2.2'
Check your current architecture with the command:使用以下命令检查您当前的架构:
arch
If this returns anything else than amd64, you're probably out of luck.如果这返回 amd64 以外的任何内容,则您可能不走运。 Unless you installed a 32-bit PC Ubuntu image on a 64-bit PC.
除非您在 64 位 PC 上安装了 32 位 PC Ubuntu 映像。 If that's the case, reinstall Ubuntu, using a 64-bit PC (AMD64) install image.
如果是这种情况,请使用 64 位 PC (AMD64) 安装映像重新安装 Ubuntu。
The update is missing:缺少更新:
sudo apt-get update
sudo apt-get install dotnet-sdk-2.1.4
When doing sudo apt-get update
you may get this error:执行
sudo apt-get update
您可能会收到此错误:
W: GPG error: https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
E: The repository 'https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod bionic InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Note that it's not that obvious (it's all the same font color and can be easily overlooked if you don't read everything that gets printed to the console output).请注意,它并不是那么明显(它们都是相同的字体颜色,如果您不阅读打印到控制台输出的所有内容,则很容易被忽略)。
It can be fixed with this command:可以使用以下命令修复它:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 6494C6D6997C215E
I'm not really sure what it actually does, looks like adding a 3rd party certificate authority or something like that.我不太确定它实际上做了什么,看起来像是添加了 3rd 方证书颁发机构或类似的东西。 Any way, after redoing
sudo apt-get update
and sudo apt-get install dotnet-sdk-2.1.4
the package can finally be installed without the "couldn't find" errors.无论如何,在重做
sudo apt-get update
和sudo apt-get install dotnet-sdk-2.1.4
该软件包最终可以安装而不会出现“找不到”错误。
This answer is bit late but I believe act of adding value is never late .这个答案有点晚了,但我相信增加价值的行为永远不会晚。
I found these writing links below to be very helpfull and detailed it is detailed enough about installing the ubuntu on linux and discussing .NET Core releases and versions of Ubuntu they are supported on.我发现下面的这些写作链接非常有用且详细,关于在 linux 上安装 ubuntu 并讨论 .NET Core 版本和支持它们的 Ubuntu 版本已经足够详细了。
INSTALL DOTNET CORE LINUX : HOW TO INSTALL .NET CORE ON UBUNTU 安装 DOTNET CORE LINUX:如何在 UBUNTU 上安装 .NET CORE
It also has link on how to install latest ubuntu 20.04 as well.它还包含有关如何安装最新的 ubuntu 20.04 的链接。
How to Install .NET core 3.1 on Ubuntu 20.04 LTS (Focal Fossa) 如何在 Ubuntu 20.04 LTS (Focal Fossa) 上安装 .NET core 3.1
On WSL 16.04 I couldn't resolve the Microsoft or debian server locations.在 WSL 16.04 上,我无法解析 Microsoft 或 debian 服务器位置。 Here were the steps I took:
以下是我采取的步骤:
cd /etc/ cd /etc/
sudo chmod 777 resolv.conf须藤chmod 777 resolv.conf
cat resolv.conf (if no 8.8.8.8 for Google dns then follow the next line) cat resolv.conf(如果 Google dns 没有 8.8.8.8,则按照下一行)
echo "nameserver 8.8.8.8" >> resolv.conf回声“名称服务器 8.8.8.8”>> resolv.conf
sudo wget http://ftp.us.debian.org/debian/pool/main/i/icu/libicu57_57.1-6+deb9u4_amd64.deb须藤 wget http://ftp.us.debian.org/debian/pool/main/i/icu/libicu57_57.1-6+deb9u4_amd64.deb
sudo dpkg -i libicu57_57.1-6+deb9u4_amd64.deb须藤 dpkg -i libicu57_57.1-6+deb9u4_amd64.deb
sudo apt install dotnet-sdk-3.1 (change the version number to the one you want) sudo apt install dotnet-sdk-3.1(把版本号改成你想要的)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.