CentOS7安裝.NET Core運行環境

安裝.NET Core

 ->首先須要刪除之前安裝的版本

 -> 獲取安裝腳本

curl -sSL https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview1/scripts/obtain/dotnet-install.sh | bash /dev/stdin --version 1.0.0-preview1-002702 --install-dir ~/dotnet

注:在CentOS中要安裝.net core環境須要libunwind和libicu庫,因此要先安裝好這兩個運行庫,不然會報錯:git

dotnet_install: Error: Unable to locate libunwind. Install libunwind to continue
dotnet_install: Error: Unable to locate libicu. Install libicu to continuegithub

yum install libunwind
yum install libicu

 

 -> 安裝完.net core後咱們須要配置一個快捷方式,也能夠配置環境變量,不然CentOS不認識dotnet命令

sudo ln -s ~/dotnet/dotnet /usr/local/bin

到這裏CentOS的.NET Core環境安裝完畢!web

 

測試運行環境

  -> 新建一個.Net項目bash

  

#建立項目文件夾
mkdir myfirstdotnetcoreapp
cd myfirstdotnetcoreapp

#建立項目
dotnet new

#編譯
dotnet restore

#運行
dotnet run

運行成功後打印:app

Project myfirstdotnetapp (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
Hello World!curl

相關文章
相關標籤/搜索