CentOS 安装 NET Core SDK 

  1. 注册 Microsoft 密钥和源
    sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
  2. 安装 .NET Core SDK
    sudo yum install dotnet-sdk-3.1
    在安装过程中如提示需要安装依赖的话执行:
    sudo yum install libunwind libicu

    若提示找不到安装包,说明yum源 需要升级则 更换yum源 centos更换阿里云的YUM源的方法

    1、备份
    
    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
    
    2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/
    
    CentOS 5
    
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
    
    或者
    curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
    
    CentOS 6
    
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    
    或者
    curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    
    CentOS 7
    
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    
    或者
    curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    
    3、之后运行yum makecache生成缓存

    更新完yum 后重新执行以下安装步骤即可

    sudo yum install libunwind libicu
    
    sudo yum install dotnet-sdk-3.1 

    安装完成后查看是否安装成功

    [bob@localhost ~]$ dotnet --info
    .NET Core SDK (reflecting any global.json):
     Version:   2.1.509
     Commit:    76b7a25db8
    
    Runtime Environment:
     OS Name:     centos
     OS Version:  8
     OS Platform: Linux
     RID:         centos.8-x64
     Base Path:   /usr/lib64/dotnet/sdk/2.1.509/
    
    Host (useful for support):
      Version: 3.1.3
      Commit:  4a9f85e9f8
    
    .NET Core SDKs installed:
      2.1.509 [/usr/lib64/dotnet/sdk]
    
    .NET Core runtimes installed:
      Microsoft.AspNetCore.App 3.1.3 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
      Microsoft.NETCore.App 2.1.13 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
      Microsoft.NETCore.App 3.1.3 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
    
    To install additional .NET Core runtimes or SDKs:
      https://aka.ms/dotnet-download

     



 

posted @ 2020-04-23 16:29  bob_zb  阅读(1272)  评论(0编辑  收藏  举报