首先要进行更新下镜像文件
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc sudo sh -c 'echo -e "[packages-microsoft-com-prod]\nname=packages-microsoft-com-prod \nbaseurl= https://packages.microsoft.com/yumrepos/microsoft-rhel7.3-prod\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/dotnetdev.repo'
[root@localhost /]# rpm --import https://packages.microsoft.com/keys/microsoft.asc
[root@localhost /]# sh -c 'echo -e "[packages-microsoft-com-prod]\nname=packages-microsoft-com-prod \nbaseurl= https://packages.microsoft.com/yumrepos/microsoft-rhel7.3-prod\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/dotnetdev.repo'
接着就可以直接安装了
Install the .NET SDK
Update the products available for installation, install the components required by .NET, then install the .NET SDK.
In your command prompt, run the following commands:
sudo yum update sudo yum install libunwind libicu sudo yum install dotnet-sdk-2.1.103
A command will be run during the install process that will improve project restore speed and enable offline access. It will take up to a minute to complete.
验证中 : aspnetcore-store-2.0.6-2.0.6-1.x86_64 1/8
验证中 : dotnet-runtime-2.0.6-2.0.6-1.x86_64 2/8
验证中 : dotnet-hostfxr-2.0.6-2.0.6-1.x86_64 3/8
验证中 : aspnetcore-store-2.0.5-2.0.5-1.x86_64 4/8
验证中 : aspnetcore-store-2.0.3-2.0.3-1.x86_64 5/8
验证中 : dotnet-sdk-2.1.103-2.1.103-1.x86_64 6/8
验证中 : dotnet-host-2.1.0_preview1_26216_03-1.x86_64 7/8
验证中 : aspnetcore-store-2.0.0-2.0.0-1.x86_64 8/8
已安装:
dotnet-sdk-2.1.103.x86_64 0:2.1.103-1
作为依赖被安装:
aspnetcore-store-2.0.0.x86_64 0:2.0.0-1 aspnetcore-store-2.0.3.x86_64 0:2.0.3-1 aspnetcore-store-2.0.5.x86_64 0:2.0.5-1 aspnetcore-store-2.0.6.x86_64 0:2.0.6-1
dotnet-host.x86_64 0:2.1.0_preview1_26216_03-1 dotnet-hostfxr-2.0.6.x86_64 0:2.0.6-1 dotnet-runtime-2.0.6.x86_64 0:2.0.6-1
好了,现在你可以运行donet命令进行测试了,默认安装目录在/usr/share/dotnet下面
dotnet --version#查看版本
dotnet --info #查看安装的信息
dotnet new razor #可以创建一个razorPage项目,