ubuntu22.04在线安装.net6SDK
- 运行以下命令,查找下载对应包文件
sudo apt update && sudo apt install dotnet6
如果只想安装部分组件,命令如下:
// 仅安装特定组件 sudo apt install dotnet-sdk-6.0 sudo apt install dotnet-runtime-6.O sudo apt install aspnetcore-runtime-6.0
但是运行命令后报错如下:N: See apt-secure(8) manpage for repository creation and user configuration details. N: Updating from such a repository can't be done securely, and is therefore disabled by default. E: The repository 'http://archive.ubuntu.com/ubuntu jammy InRelease' is no longer signed. E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease 901 [IP: 122.229.31.17 80] N: See apt-secure(8) manpage for repository creation and user configuration details. N: Updating from such a repository can't be done securely, and is therefore disabled by default. E: The repository 'http://archive.ubuntu.com/ubuntu jammy-updates InRelease' is no longer signed. E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease 901 [IP: 122.229.31.17 80] E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease 901 [IP: 122.229.31.17 80] E: The repository 'http://archive.ubuntu.com/ubuntu jammy-backports InRelease' is no longer 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. E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-security/InRelease 901 [IP: 122.229.31.17 80] E: The repository 'http://archive.ubuntu.com/ubuntu jammy-security InRelease' is no longer 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.
ping了一下报错信息中的IP地址发现也是通的
接着尝试网上找到的方法
1.apt-get update 或者 apt-get clean或者 apt-get update,三个命令全部执行完成后,发现问题依旧
2.运行修改的命令 apt-get update --fix-missing 问题未解决
3.更换source ,打开文件 sudo vim /etc/resolv.conf 并在文件中添加 nameserver 8.8.8.8,问题还是没有解决
4.修改虚拟机的网络配置,修改为NAT,再次执行安装的代码
成功执行,具体原因不太清楚两种网络方式有什么不同,两种都是可以ping通外网的.
查看安装是否成功dotnet --info
出现版本信息,代表安装成功
- 卸载dotnet命令
dotnet --list-sdks # 查看下载的 sdk dotnet --list-runtimes # 查看下载的 runtime sudo apt remove dotnet-sdk-$版本号 sudo apt remove dotnet-runtime-$版本号