Ubuntu下安装部署.NET Core多版本环境(转)
参考地址
https://cloud.tencent.com/developer/article/1333808
#创建并进入下载目录
sudo mkdir -p /home/download && cd /home/download
#下载.NET Core 2.0
sudo wget --no-check-certificate -O dotnet-2.0.tar.gz https://download.microsoft.com/download/1/B/4/1B4DE605-8378-47A5-B01B-2C79D6C55519/dotnet-sdk-2.0.0-linux-x64.tar.gz
#下载.NET Core 2.1
sudo wget --no-check-certificate -O dotnet-2.1.tar.gz https://download.microsoft.com/download/4/0/9/40920432-3302-47a8-b13c-bbc4848ad114/dotnet-sdk-2.1.302-linux-x64.tar.gz
# 20200611最新版本
https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-2.1.807-linux-x64-binaries
#下载.NET Core 3.1
sudo wget --no-check-certificate -O dotnet-3.1.tar.gz https://download.visualstudio.microsoft.com/download/pr/37268c18-226d-436b-b13c-4b77b7f42140/17e8a85360206006a557d634d16713cd/dotnet-sdk-3.1.105-linux-x64.tar.gz
#创建dotnet根目录
sudo mkdir /usr/dotnet
#解压.NET Core 2.0到指定目录
sudo mkdir /usr/dotnet/dotnet-2.0
sudo tar zvxf dotnet-2.0.tar.gz -C /usr/dotnet/dotnet-2.0
#解压.NET Core 2.1到指定目录
sudo mkdir /usr/dotnet/dotnet-2.1
sudo tar zvxf dotnet-2.1.tar.gz -C /usr/dotnet/dotnet-2.1
#解压.NET Core 3.1到指定目录
sudo mkdir /usr/dotnet/dotnet-3.1
sudo tar zvxf dotnet-3.1.tar.gz -C /usr/dotnet/dotnet-3.1
#安装基础依赖
sudo apt-get install -y libunwind8 apt-transport-https
#配置环境入口
#创建.NET Core 2.0软链接
sudo ln -s /usr/dotnet/dotnet-2.0/dotnet /usr/bin/dotnet2.0
#创建.NET Core 2.1软链接
sudo ln -s /usr/dotnet/dotnet-2.1/dotnet /usr/bin/dotnet2.1
#创建.NET Core 3.1软链接
sudo ln -s /usr/dotnet/dotnet-3.1/dotnet /usr/bin/dotnet3.1
#查看.NET Core 2.0环境信息
dotnet2.0 --info
#查看.NET Core 2.1环境信息
dotnet2.1 --info
#查看.NET Core 3.1环境信息
dotnet3.1 --info