1、Debian上安装.NET Core2.1
1)注册Microsoft密钥和订阅源
wget -qO-https://packages.microsoft.com/keys/microsoft.asc
| gpg --dearmor > microsoft.asc.gpg
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget -qhttps://packages.microsoft.com/config/debian/9/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list
注意:wget -q
中https://packages.microsoft.com/config/debian/9/prod.list
9
是Debian 9
中,如果是Debian 8
则将9
改成8
。
2)安装.NET Core SDK
sudo apt-get update
sudo apt-get install dotnet-sdk-2.1
2、Fedora上安装.NET Core2.1
1)注册Microsoft密钥和订阅源
sudo rpm --importhttps://packages.microsoft.com/keys/microsoft.asc
wget -qhttps://packages.microsoft.com/config/fedora/27/prod.repo
sudo mv prod.repo /etc/yum.repos.d/microsoft-prod.repo sudo chown root:root /etc/yum.repos.d/microsoft-prod.repo
注意:wget -q
中https://packages.microsoft.com/config/fedora/27/prod.repo
27
是fedora 27
中,如果是Debian 28
则将27
改成28
。
2)安装.NET Core SDK
sudo dnf update
sudo dnf install dotnet-sdk-2.1
3、CentOS上安装.NET Core2.1
1)注册Microsoft密钥和订阅源
sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
注意:sudo rpm -Uvh
中https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
7
是CentOS7
中,如果是CentOS6
则将7
改成6
。
2)安装.NET Core SDK
sudo yum update
sudo yum install dotnet-sdk-2.1
4、验证是否安装成功
dotnet --version
显示版本号则安装成功。
官方文档:https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current