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库,所以要先安装好这两个运行库,否则会报错:
dotnet_install: Error: Unable to locate libunwind. Install libunwind to continue
dotnet_install: Error: Unable to locate libicu. Install libicu to continue
yum install libunwind yum install libicu
-> 安装完.net core后我们需要配置一个快捷方式,也可以配置环境变量,否则CentOS不认识dotnet命令
sudo ln -s ~/dotnet/dotnet /usr/local/bin
到这里CentOS的.NET Core环境安装完毕!
测试运行环境
-> 新建一个.Net项目
#创建项目文件夹 mkdir myfirstdotnetcoreapp cd myfirstdotnetcoreapp #创建项目 dotnet new #编译 dotnet restore #运行 dotnet run
运行成功后打印:
Project myfirstdotnetapp (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
Hello World!