Ubuntu 16.04 Package Manager - 安装 .NET Core 2.2

Ubuntu 16.04 Package Manager - 安装 .NET Core 2.2

Package manager installs are only supported on the x64 architecture.

This article describes how to use a package manager to install .NET Core on Ubuntu 16.04. If you’re installing the runtime, we suggest you install the ASP.NET Core runtime, as it includes both .NET Core and ASP.NET Core runtimes.

1. Register Microsoft key and feed

Open a terminal and run the following commands.

wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
(base) yongqiang@famu-sys:~$ wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
(base) yongqiang@famu-sys:~$
(base) yongqiang@famu-sys:~$ sudo dpkg -i packages-microsoft-prod.deb
[sudo] yongqiang 的密码:
正在选中未选择的软件包 packages-microsoft-prod。
(正在读取数据库 ... 系统当前共安装有 241296 个文件和目录。)
正准备解包 packages-microsoft-prod.deb  ...
正在解包 packages-microsoft-prod (1.0-3) ...
正在设置 packages-microsoft-prod (1.0-3) ...
(base) yongqiang@famu-sys:~$

2. Install the .NET Core SDK

Update the products available for installation, then install the .NET Core SDK. In your terminal, run the following commands.

sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.2
(base) yongqiang@famu-sys:~$ sudo apt-get update
命中:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease
获取:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates InRelease [109 kB]
获取:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports InRelease [107 kB]
获取:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security InRelease [109 kB]
命中:5 http://linux.teamviewer.com/deb stable InRelease
获取:6 https://packages.microsoft.com/ubuntu/16.04/prod xenial InRelease [4,003 B]
命中:7 http://linux.teamviewer.com/deb preview InRelease
获取:8 https://packages.microsoft.com/ubuntu/16.04/prod xenial/main amd64 Packages [117 kB]
获取:9 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/main amd64 DEP-11 Metadata [322 kB]
获取:10 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/main DEP-11 64x64 Icons [231 kB]
获取:11 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/universe amd64 DEP-11 Metadata [274 kB]
获取:12 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/universe DEP-11 64x64 Icons [406 kB]
获取:13 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata [5,960 B]
获取:14 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/multiverse DEP-11 64x64 Icons [14.3 kB]
获取:15 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports/main amd64 DEP-11 Metadata [3,328 B]
获取:16 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports/universe amd64 DEP-11 Metadata [5,320 B]
获取:17 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/main amd64 DEP-11 Metadata [74.8 kB]
获取:18 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/main DEP-11 64x64 Icons [83.8 kB]
获取:19 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/universe amd64 DEP-11 Metadata [124 kB]
获取:20 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/universe DEP-11 64x64 Icons [194 kB]
获取:21 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/multiverse amd64 DEP-11 Metadata [2,464 B]
已下载 2,186 kB,耗时 7秒 (289 kB/s)
正在读取软件包列表... 完成
(base) yongqiang@famu-sys:~$
(base) yongqiang@famu-sys:~$ sudo apt-get install apt-transport-https
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
下列软件包将被升级:
  apt-transport-https
升级了 1 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 394 个软件包未被升级。
需要下载 26.5 kB 的归档。
解压缩后会消耗 1,024 B 的额外空间。
获取:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/main amd64 apt-transport-https amd64 1.2.32 [26.5 kB]
已下载 26.5 kB,耗时 0秒 (299 kB/s)
(正在读取数据库 ... 系统当前共安装有 241301 个文件和目录。)
正准备解包 .../apt-transport-https_1.2.32_amd64.deb  ...
正在将 apt-transport-https (1.2.32) 解包到 (1.2.27) 上 ...
正在设置 apt-transport-https (1.2.32) ...
(base) yongqiang@famu-sys:~$
(base) yongqiang@famu-sys:~$ sudo apt-get update
命中:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease
命中:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates InRelease
命中:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports InRelease
命中:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security InRelease
命中:5 http://linux.teamviewer.com/deb stable InRelease
命中:6 http://linux.teamviewer.com/deb preview InRelease
命中:7 https://packages.microsoft.com/ubuntu/16.04/prod xenial InRelease
正在读取软件包列表... 完成
(base) yongqiang@famu-sys:~$
(base) yongqiang@famu-sys:~$ sudo apt-get install dotnet-sdk-2.2
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
将会同时安装下列软件:
  aspnetcore-runtime-2.2 dotnet-host dotnet-hostfxr-2.2 dotnet-runtime-2.2 dotnet-runtime-deps-2.2 liblttng-ust-ctl2 liblttng-ust0 liburcu4
下列【新】软件包将被安装:
  aspnetcore-runtime-2.2 dotnet-host dotnet-hostfxr-2.2 dotnet-runtime-2.2 dotnet-runtime-deps-2.2 dotnet-sdk-2.2 liblttng-ust-ctl2
  liblttng-ust0 liburcu4
升级了 0 个软件包,新安装了 9 个软件包,要卸载 0 个软件包,有 394 个软件包未被升级。
需要下载 136 MB 的归档。
解压缩后会消耗 400 MB 的额外空间。
您希望继续执行吗? [Y/n] Y
获取:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial/universe amd64 liburcu4 amd64 0.9.1-3 [47.3 kB]
获取:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial/universe amd64 liblttng-ust-ctl2 amd64 2.7.1-1 [72.2 kB]
获取:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial/universe amd64 liblttng-ust0 amd64 2.7.1-1 [127 kB]
获取:4 https://packages.microsoft.com/ubuntu/16.04/prod xenial/main amd64 dotnet-runtime-deps-2.2 amd64 2.2.8-1 [2,664 B]
获取:5 https://packages.microsoft.com/ubuntu/16.04/prod xenial/main amd64 dotnet-host amd64 3.1.1-1 [32.5 kB]
获取:6 https://packages.microsoft.com/ubuntu/16.04/prod xenial/main amd64 dotnet-hostfxr-2.2 amd64 2.2.8-1 [143 kB]
获取:7 https://packages.microsoft.com/ubuntu/16.04/prod xenial/main amd64 dotnet-runtime-2.2 amd64 2.2.8-1 [20.7 MB]
获取:8 https://packages.microsoft.com/ubuntu/16.04/prod xenial/main amd64 aspnetcore-runtime-2.2 amd64 2.2.8-1 [22.9 MB]
获取:9 https://packages.microsoft.com/ubuntu/16.04/prod xenial/main amd64 dotnet-sdk-2.2 amd64 2.2.402-1 [91.5 MB]
已下载 136 MB,耗时 1分 20秒 (1,675 kB/s)
正在选中未选择的软件包 liburcu4:amd64。
(正在读取数据库 ... 系统当前共安装有 241301 个文件和目录。)
正准备解包 .../liburcu4_0.9.1-3_amd64.deb  ...
正在解包 liburcu4:amd64 (0.9.1-3) ...
正在选中未选择的软件包 liblttng-ust-ctl2:amd64。
正准备解包 .../liblttng-ust-ctl2_2.7.1-1_amd64.deb  ...
正在解包 liblttng-ust-ctl2:amd64 (2.7.1-1) ...
正在选中未选择的软件包 liblttng-ust0:amd64。
正准备解包 .../liblttng-ust0_2.7.1-1_amd64.deb  ...
正在解包 liblttng-ust0:amd64 (2.7.1-1) ...
正在选中未选择的软件包 dotnet-runtime-deps-2.2。
正准备解包 .../dotnet-runtime-deps-2.2_2.2.8-1_amd64.deb  ...
正在解包 dotnet-runtime-deps-2.2 (2.2.8-1) ...
正在选中未选择的软件包 dotnet-host。
正准备解包 .../dotnet-host_3.1.1-1_amd64.deb  ...
正在解包 dotnet-host (3.1.1-1) ...
正在选中未选择的软件包 dotnet-hostfxr-2.2。
正准备解包 .../dotnet-hostfxr-2.2_2.2.8-1_amd64.deb  ...
正在解包 dotnet-hostfxr-2.2 (2.2.8-1) ...
正在选中未选择的软件包 dotnet-runtime-2.2。
正准备解包 .../dotnet-runtime-2.2_2.2.8-1_amd64.deb  ...
正在解包 dotnet-runtime-2.2 (2.2.8-1) ...
正在选中未选择的软件包 aspnetcore-runtime-2.2。
正准备解包 .../aspnetcore-runtime-2.2_2.2.8-1_amd64.deb  ...
正在解包 aspnetcore-runtime-2.2 (2.2.8-1) ...
正在选中未选择的软件包 dotnet-sdk-2.2。
正准备解包 .../dotnet-sdk-2.2_2.2.402-1_amd64.deb  ...
正在解包 dotnet-sdk-2.2 (2.2.402-1) ...
正在处理用于 libc-bin (2.23-0ubuntu10) 的触发器 ...
正在处理用于 man-db (2.7.5-1) 的触发器 ...
正在设置 liburcu4:amd64 (0.9.1-3) ...
正在设置 liblttng-ust-ctl2:amd64 (2.7.1-1) ...
正在设置 liblttng-ust0:amd64 (2.7.1-1) ...
正在设置 dotnet-runtime-deps-2.2 (2.2.8-1) ...
正在设置 dotnet-host (3.1.1-1) ...
正在设置 dotnet-hostfxr-2.2 (2.2.8-1) ...
正在设置 dotnet-runtime-2.2 (2.2.8-1) ...
正在设置 aspnetcore-runtime-2.2 (2.2.8-1) ...
正在设置 dotnet-sdk-2.2 (2.2.402-1) ...
This software may collect information about you and your use of the software, and send that to Microsoft.
Please visit http://aka.ms/dotnet-cli-eula for more information.
Welcome to .NET Core!
---------------------
Learn more about .NET Core: https://aka.ms/dotnet-docs
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs

Telemetry
---------
The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous and doesn't include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

Configuring...
--------------
A command is running to populate your local package cache to improve restore speed and enable offline access. This command takes up to one minute to complete and only runs once.
正在处理用于 libc-bin (2.23-0ubuntu10) 的触发器 ...
(base) yongqiang@famu-sys:~$

For example, there isn’t an ASP.NET Core SDK, the SDK components are included with the .NET Core SDK. The value aspnetcore-sdk-2.2 is incorrect and should be dotnet-sdk-2.2.
例如,没有 ASP.NET Core SDK,SDK 组件包含在 .NET Core SDK 中。值 aspnetcore-sdk-2.2 不正确,应为 dotnet-sdk-2.2

References

https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-ubuntu-1604

发布了443 篇原创文章 · 获赞 1685 · 访问量 101万+

猜你喜欢

转载自blog.csdn.net/chengyq116/article/details/104327320
今日推荐