Centos下安裝 .net Core執行程式

kingkoo發表於2018-04-09

首先要進行更新下映象檔案

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專案,

  

相關文章