环境:
- centos8.2 最小化安装
- .net 5.0
一、CentOS8.2在线安装.net 5.0
直接执行命令:sudo dnf install dotnet-sdk-5.0
[root@bogon ~]# sudo dnf install dotnet-sdk-5.0 -y
上次元数据过期检查:0:00:13 前,执行于 2021年05月12日 星期三 15时23分57秒。
依赖关系解决。
=============================================================================================================================================================================================
软件包 架构 版本 仓库 大小
=============================================================================================================================================================================================
安装:
dotnet-sdk-5.0 x86_64 5.0.102-2.el8_3 AppStream 48 M
安装依赖关系:
aspnetcore-runtime-5.0 x86_64 5.0.2-2.el8_3 AppStream 6.5 M
aspnetcore-targeting-pack-5.0 x86_64 5.0.2-2.el8_3 AppStream 1.4 M
dotnet-apphost-pack-5.0 x86_64 5.0.2-2.el8_3 AppStream 3.8 M
dotnet-host x86_64 5.0.2-2.el8_3 AppStream 108 k
dotnet-hostfxr-5.0 x86_64 5.0.2-2.el8_3 AppStream 154 k
dotnet-runtime-5.0 x86_64 5.0.2-2.el8_3 AppStream 27 M
dotnet-targeting-pack-5.0 x86_64 5.0.2-2.el8_3 AppStream 2.4 M
dotnet-templates-5.0 x86_64 5.0.102-2.el8_3 AppStream 1.9 M
libicu x86_64 60.3-2.el8_1 BaseOS 8.8 M
lttng-ust x86_64 2.8.1-11.el8 AppStream 259 k
netstandard-targeting-pack-2.1 x86_64 5.0.102-2.el8_3 AppStream 1.5 M
userspace-rcu x86_64 0.10.1-2.el8 BaseOS 101 k
事务概要
=============================================================================================================================================================================================
安装 13 软件包
总下载:102 M
安装大小:376 M
下载软件包:
(1/13): aspnetcore-targeting-pack-5.0-5.0.2-2.el8_3.x86_64.rpm 1.2 MB/s | 1.4 MB 00:01
(2/13): dotnet-apphost-pack-5.0-5.0.2-2.el8_3.x86_64.rpm 1.9 MB/s | 3.8 MB 00:01
(3/13): dotnet-host-5.0.2-2.el8_3.x86_64.rpm 131 kB/s | 108 kB 00:00
(4/13): dotnet-hostfxr-5.0-5.0.2-2.el8_3.x86_64.rpm 1.4 MB/s | 154 kB 00:00
(5/13): aspnetcore-runtime-5.0-5.0.2-2.el8_3.x86_64.rpm 1.6 MB/s | 6.5 MB 00:04
(6/13): dotnet-targeting-pack-5.0-5.0.2-2.el8_3.x86_64.rpm 1.6 MB/s | 2.4 MB 00:01
(7/13): dotnet-templates-5.0-5.0.102-2.el8_3.x86_64.rpm 1.7 MB/s | 1.9 MB 00:01
(8/13): lttng-ust-2.8.1-11.el8.x86_64.rpm 1.1 MB/s | 259 kB 00:00
(9/13): netstandard-targeting-pack-2.1-5.0.102-2.el8_3.x86_64.rpm 1.6 MB/s | 1.5 MB 00:00
(10/13): dotnet-runtime-5.0-5.0.2-2.el8_3.x86_64.rpm 1.9 MB/s | 27 MB 00:14
(11/13): userspace-rcu-0.10.1-2.el8.x86_64.rpm 382 kB/s | 101 kB 00:00
(12/13): dotnet-sdk-5.0-5.0.102-2.el8_3.x86_64.rpm 2.9 MB/s | 48 MB 00:16
(13/13): libicu-60.3-2.el8_1.x86_64.rpm 560 kB/s | 8.8 MB 00:16
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 4.1 MB/s | 102 MB 00:24
警告:/var/cache/dnf/AppStream-a520ed22b0a8a736/packages/aspnetcore-runtime-5.0-5.0.2-2.el8_3.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 8483c65d: NOKEY
CentOS-8 - AppStream 1.4 MB/s | 1.6 kB 00:00
导入 GPG 公钥 0x8483C65D:
Userid: "CentOS (CentOS Official Signing Key) <security@centos.org>"
指纹: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
来自: /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
导入公钥成功
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
准备中 : 1/1
安装 : dotnet-host-5.0.2-2.el8_3.x86_64 1/13
安装 : aspnetcore-targeting-pack-5.0-5.0.2-2.el8_3.x86_64 2/13
安装 : dotnet-apphost-pack-5.0-5.0.2-2.el8_3.x86_64 3/13
安装 : dotnet-hostfxr-5.0-5.0.2-2.el8_3.x86_64 4/13
安装 : dotnet-targeting-pack-5.0-5.0.2-2.el8_3.x86_64 5/13
安装 : dotnet-templates-5.0-5.0.102-2.el8_3.x86_64 6/13
安装 : netstandard-targeting-pack-2.1-5.0.102-2.el8_3.x86_64 7/13
安装 : userspace-rcu-0.10.1-2.el8.x86_64 8/13
运行脚本: userspace-rcu-0.10.1-2.el8.x86_64 8/13
安装 : lttng-ust-2.8.1-11.el8.x86_64 9/13
运行脚本: lttng-ust-2.8.1-11.el8.x86_64 9/13
安装 : libicu-60.3-2.el8_1.x86_64 10/13
运行脚本: libicu-60.3-2.el8_1.x86_64 10/13
安装 : dotnet-runtime-5.0-5.0.2-2.el8_3.x86_64 11/13
安装 : aspnetcore-runtime-5.0-5.0.2-2.el8_3.x86_64 12/13
安装 : dotnet-sdk-5.0-5.0.102-2.el8_3.x86_64 13/13
运行脚本: dotnet-sdk-5.0-5.0.102-2.el8_3.x86_64 13/13
验证 : aspnetcore-runtime-5.0-5.0.2-2.el8_3.x86_64 1/13
验证 : aspnetcore-targeting-pack-5.0-5.0.2-2.el8_3.x86_64 2/13
验证 : dotnet-apphost-pack-5.0-5.0.2-2.el8_3.x86_64 3/13
验证 : dotnet-host-5.0.2-2.el8_3.x86_64 4/13
验证 : dotnet-hostfxr-5.0-5.0.2-2.el8_3.x86_64 5/13
验证 : dotnet-runtime-5.0-5.0.2-2.el8_3.x86_64 6/13
验证 : dotnet-sdk-5.0-5.0.102-2.el8_3.x86_64 7/13
验证 : dotnet-targeting-pack-5.0-5.0.2-2.el8_3.x86_64 8/13
验证 : dotnet-templates-5.0-5.0.102-2.el8_3.x86_64 9/13
验证 : lttng-ust-2.8.1-11.el8.x86_64 10/13
验证 : netstandard-targeting-pack-2.1-5.0.102-2.el8_3.x86_64 11/13
验证 : libicu-60.3-2.el8_1.x86_64 12/13
验证 : userspace-rcu-0.10.1-2.el8.x86_64 13/13
已安装:
aspnetcore-runtime-5.0-5.0.2-2.el8_3.x86_64 aspnetcore-targeting-pack-5.0-5.0.2-2.el8_3.x86_64 dotnet-apphost-pack-5.0-5.0.2-2.el8_3.x86_64
dotnet-host-5.0.2-2.el8_3.x86_64 dotnet-hostfxr-5.0-5.0.2-2.el8_3.x86_64 dotnet-runtime-5.0-5.0.2-2.el8_3.x86_64
dotnet-sdk-5.0-5.0.102-2.el8_3.x86_64 dotnet-targeting-pack-5.0-5.0.2-2.el8_3.x86_64 dotnet-templates-5.0-5.0.102-2.el8_3.x86_64
libicu-60.3-2.el8_1.x86_64 lttng-ust-2.8.1-11.el8.x86_64 netstandard-targeting-pack-2.1-5.0.102-2.el8_3.x86_64
userspace-rcu-0.10.1-2.el8.x86_64
完毕!
[root@bogon ~]#
安装完成后查看dotnet版本:
[root@bogon test]# dotnet --version
5.0.102
[root@bogon test]# dotnet --info
.NET SDK (反映任何 global.json):
Version: 5.0.102
Commit: 71365b4d42
运行时环境:
OS Name: centos
OS Version: 8
OS Platform: Linux
RID: centos.8-x64
Base Path: /usr/lib64/dotnet/sdk/5.0.102/
Host (useful for support):
Version: 5.0.2
Commit: cb5f173b96
.NET SDKs installed:
5.0.102 [/usr/lib64/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.2 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.2 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
[root@bogon test]#
二、centos7.6 在线安装.net 5.0
首先,配置仓库:
sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
然后,执行安装命令:
sudo yum install dotnet-sdk-5.0 -y
安装完成后,查看dotnet版本:
[root@bogon ~]# dotnet --version
5.0.203
[root@bogon ~]# dotnet --info
.NET SDK (反映任何 global.json):
Version: 5.0.203
Commit: 383637d63f
运行时环境:
OS Name: centos
OS Version: 7
OS Platform: Linux
RID: centos.7-x64
Base Path: /usr/share/dotnet/sdk/5.0.203/
Host (useful for support):
Version: 5.0.6
Commit: 478b2f8c0e
.NET SDKs installed:
5.0.203 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
[root@bogon ~]#
三、CentOS8.2离线安装.net 5.0
3.1 准备离线安装包
安装包的下载地址:https://dotnet.microsoft.com/download/dotnet/5.0
下载后如下:
3.2 安装依赖项:
从官网上看到一些依赖项如下:
安装依赖:
yum install krb5-libs libicu openssl-libs zlib -y
3.3 安装.net 5
将net5的安装包上传到 /usr/local/
目录下,然后在这个目录下创建文件夹dotnet
,最后将net5的安装包解压到这个dotnet
目录下:
[root@bogon local]# mkdir dotnet
[root@bogon local]# tar -zxvf dotnet-sdk-5.0.203-linux-x64.tar.gz -C dotnet
...
将dotnet添加到环境变量中:
[root@bogon local]# export DOTNET_ROOT=/usr/local/dotnet
[root@bogon local]# export PATH=$DOTNET_ROOT:$PATH
刷新环境变量:
[root@bogon local]# source /etc/profile
3.4 验证安装
[root@bogon local]# dotnet --version
5.0.203
[root@bogon local]# dotnet --info
.NET SDK (反映任何 global.json):
Version: 5.0.203
Commit: 383637d63f
运行时环境:
OS Name: centos
OS Version: 8
OS Platform: Linux
RID: centos.8-x64
Base Path: /usr/local/dotnet/sdk/5.0.203/
Host (useful for support):
Version: 5.0.6
Commit: 478b2f8c0e
.NET SDKs installed:
5.0.203 [/usr/local/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.6 [/usr/local/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.6 [/usr/local/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
[root@bogon local]#
四、CentOS7.6离线安装net5.0
和CentOS8.2离线安装的一致。。。