一、RPM方式

  • 1、导入rpm源
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'
  • 2、更新yum包
sudo yum -y update
  • 3、安装基础依赖
sudo yum -y install libunwind libicu
  • 4、安装SDK
sudo yum -y install dotnet-sdk-2.0.0
  • 5、校验是否安装成功
dotnet --version

二、手动下载&安装

cd /home/downloads
wget --no-check-certificate -o dotnet-sdk-2.0.0-linux-x64.tar.gz https://download.microsoft.com/download/1/B/4/1B4DE605-8378-47A5-B01B-2C79D6C55519/dotnet-sdk-2.0.0-linux-x64.tar.gz
  • 2、更新yum包
sudo yum -y update
  • 3、安装基础依赖
sudo yum -y install libunwind libicu
  • 4、创建SDK文件夹&将SDK解压到指定文件夹中
sudo mkdir -p /usr/dotnet/dotnet-2.0 && sudo tar zxf dotnet-sdk-2.0.0-linux-x64.tar.gz -C /usr/dotnet/dotnet-2.0
  • 5、创建软连接
sudo ln -s /usr/dotnet/dotnet-2.0/dotnet /usr/local/bin
  • 6、校验是否安装成功
dotnet --version