Linux安装Dotnet SDk
以dotnet5.0为例
1.下载linux内核对应的dotnet5.0 sdk文件
进入https://dotnet.microsoft.com/en-us/download/dotnet/5.0
下载对应版本的tag包
wget -O 'dotnet-sdk-5.0.408-linux-x64.tar.gz' 'http://kode.huhuhahei.cn/index.php?explorer/share/file&hash=ec5enTgpEc6Hn2ajB82SGuL7Uv6NQVCwM4eHYUvqXjIwY98QrKmEEI8V4jIz6p7Jk7Z5'
解压
mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-5.0.408-linux-x64.tar.gz -C $HOME/dotnet
配置优化
ln -s /root/dotnet/dotnet /usr/sbin
cat >> /etc/profile <<EOF
export DOTNET_ROOT=$HOME/dotnet
PATH=$PATH:$HOME/dotnet
EOF
source /etc/profile
配置nuget默认拉取软件源
查看默认的源
dotnet nuget list source
Registered Sources:
1. nuget.org [Disabled]
https://api.nuget.org/v3/index.json
默认的源是国外的拉取速度比较慢
建议修改为国内
#关闭国外的源
dotnet nuget disable source nuget.org
#添加华为源
dotnet nuget add source --name "test" https://mirrors.huaweicloud.com/repository/nuget/v3/index.json
#再次查看
dotnet nuget list source
Registered Sources:
1. nuget.org [Disabled]
https://api.nuget.org/v3/index.json
2. test [Enabled]
https://mirrors.huaweicloud.com/repository/nuget/v3/index.json