Ubuntu - 安装 .net 核心
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37322843/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ubuntu - Installing .net core
提问by onurhb
I want to try out the new .net core. I am following instructs at https://www.microsoft.com/net/core, but it is not working.
我想尝试新的 .net 核心。我正在遵循https://www.microsoft.com/net/core 上的说明,但它不起作用。
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-dev-1.0.0-preview1-002702 : Depends: dotnet-sharedframework-microsoft.netcore.app-1.0.0-rc2-3002702 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I am running ubuntu 16.04.
我正在运行 ubuntu 16.04。
采纳答案by Frank Boucher
UPDATEDsee at the end. (thanks to Prasanna)
.NET core now supports Ubuntu 14.04, 16.04, 16.10 & Linux Mint 17.
Please check the official pagefor all the details.
更新见最后。(感谢Prasanna)
.NET 核心现在支持 Ubuntu 14.04、16.04、16.10 和 Linux Mint 17。
请查看官方页面了解所有详细信息。
Today (May 2016) only Ubuntu 14.04 is supported.
今天(2016 年 5 月)仅支持 Ubuntu 14.04。
I successfully install it on Ubuntu 15.10 by adding
我通过添加在 Ubuntu 15.10 上成功安装它
deb http://security.ubuntu.com/ubuntu trusty-security main
to /etc/apt/sources-list
到 /etc/apt/sources-list
Once it's done you should do:
完成后,您应该执行以下操作:
apt-get update
apt-get upgrade
and again the command
再次命令
apt-get install dotnet-dev-1.0.0-preview1-002702a
It will ask to install extra package; you reply yes and you are done!
它会要求安装额外的包;你回答是,你就完成了!
Test by typing
打字测试
dotnet --version
Enjoy!
享受!
UPDATED
更新
回答by Prasanna
Now .NET core supports ubuntu 16.04.
现在 .NET 核心支持 ubuntu 16.04。
Please check link for more details
请查看链接了解更多详情
https://www.microsoft.com/net/core#linuxubuntu
https://www.microsoft.com/net/core#linuxubuntu
You need to setup the apt-feed first for ubuntu 16.04.
Remove previous .net core versions from your system if any
Then install .net core sdk
您需要先为 ubuntu 16.04 设置 apt-feed。
从系统中删除以前的 .net 核心版本(如果有)
然后安装.net core sdk
回答by callmebob
September 2018 - .NET Core installation is super simple on Ubuntu:
2018 年 9 月 - 在 Ubuntu 上安装 .NET Core 非常简单:
Register the Microsoft key, product repository, and install required dependencies:
注册 Microsoft 密钥、产品存储库并安装所需的依赖项:
IMPORTANT NOTE:change the 18.04 in the below path to your Ubuntu version (i.e.: 17.10, 16.04 etc.)
重要说明:将以下路径中的 18.04 更改为您的 Ubuntu 版本(即:17.10、16.04 等)
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
Now update list of available packages and install your SDK
现在更新可用软件包列表并安装您的 SDK
sudo apt-get update
sudo apt-get install dotnet-sdk-2.1
Done!
完毕!
Additional info:
附加信息:
For me (end of Sep 2018) it was version 2.1, but you can check for more recent versions like this:
对我来说(2018 年 9 月末)它是 2.1 版,但您可以检查更新的版本,如下所示:
sudo apt-cache search dotnet-sdk
Also please NOTE:Microsoft on their official page (here) recommend use sudo apt-get install apt-transport-httpsbefore installing dotnet-sdk-your_version. This is not required anymore because (from package description):
另请注意:Microsoft 在其官方页面(此处)上建议在安装 dotnet-sdk-your_version 之前使用sudo apt-get install apt-transport-https。这不再是必需的,因为(来自包描述):
Description-en: transitional package for https support This is a dummy transitional package - https support has been moved into the apt package in 1.5. It can be safely removed.
说明-en:https 支持的过渡包这是一个虚拟的过渡包 - https 支持已移入 1.5 中的 apt 包。它可以安全地移除。
So feel free to skip this.
所以请随意跳过这个。
回答by MikeM
I am in the same boat. I want to try it without all this installation hassle. I went the docker route and found it much simpler to get up and running. Also, its much easier to clean up after trying it out since all I need to do is remove the container + image.
我在同一条船上。我想在没有所有这些安装麻烦的情况下尝试它。我选择了 docker 路线,发现启动和运行要简单得多。此外,尝试后清理起来更容易,因为我需要做的就是删除容器 + 图像。
Another reason I went this route is because I am using Ubuntu 15.10 which is not officiallycompatible with a .Net Core install for Ubuntu. So instead of upgrading my distro to "try" this out, docker was a better route.
我走这条路的另一个原因是我使用的是 Ubuntu 15.10,它与 Ubuntu 的 .Net Core 安装不正式兼容。因此,与其升级我的发行版以“尝试”这一点,docker 是一条更好的路线。
I ran it in an interactive shell, so that I can run my code:
我在交互式 shell 中运行它,以便我可以运行我的代码:
docker run -it --name dotnet -v /home/me/tmp/:/tmp/project microsoft/dotnet /bin/bash
docker run -it --name dotnet -v /home/me/tmp/:/tmp/project microsoft/dotnet /bin/bash
.. then just write some sample code using a text editor in my /home/me/tmp dir and when I want to run it, I just go to the container shell and do dotnet run.
..然后只需在我的 /home/me/tmp 目录中使用文本编辑器编写一些示例代码,当我想运行它时,我只需转到容器外壳并执行dotnet run.
See:
看:
https://github.com/dotnet/dotnet-docker
https://github.com/dotnet/dotnet-docker
回答by beespace
Trying to install the dependant package dotnet-sharedframework-microsoft.netcore.app will get you next error, saying that this package depends on libicu52 but it is not installable
尝试安装依赖包 dotnet-sharedframework-microsoft.netcore.app 会给你下一个错误,说这个包依赖于 libicu52 但它是不可安装的
http://packages.ubuntu.com/pl/trusty/amd64/libicu52/download
and download .deb package. Now, go to the download location and install the package by running:
并下载 .deb 包。现在,转到下载位置并运行以下命令安装软件包:
sudo dpkg -i libicu52_52.1-3ubuntu0.4_amd64.deb
Now, you will be able to run the following commands:
现在,您将能够运行以下命令:
sudo apt-get install dotnet-sharedframework-microsoft.netcore.app-1.0.0-rc2-3002702
sudo apt-get install dotnet-dev-1.0.0-preview1-002702
dotnet --version
Good luck
祝你好运
source: http://zablo.net/blog/post/run-and-debug-asp-net-core-rc2-ubuntu-16-04
来源:http: //zablo.net/blog/post/run-and-debug-asp-net-core-rc2-ubuntu-16-04
回答by Dinil Sennath
I also got same problem. I checked out many solutions. But they didn't work. Finally i discovered i have followed their 'Ubuntu 16.10' instruction instead of 'Ubuntu 16.04'. There was bit difference between them. Make sure you have followed correct instruction.
我也遇到了同样的问题。我检查了许多解决方案。但他们没有工作。最后我发现我遵循了他们的“Ubuntu 16.10”指令而不是“Ubuntu 16.04”。他们之间有一点不同。确保您遵循了正确的说明。
回答by Hiren Parghi
This package depends on libicu52. You will need to download the .deb package from the following url.
这个包依赖于 libicu52。您需要从以下 url 下载 .deb 包。
> http://packages.ubuntu.com/pl/trusty/amd64/libicu52/download
Now, install it using the following command.
现在,使用以下命令安装它。
> sudo dpkg -i libicu52_52.1-3ubuntu0.4_amd64.deb
You can install the .net core with this command.
您可以使用此命令安装 .net 核心。
> apt-get install dotnet-dev-1.0.0-preview1-002702a
Check the version which you have installed.
检查您安装的版本。
> dotnet --version

