zoukankan      html  css  js  c++  java
  • 在Ubuntu 18.04中安装.NetCore 3.1运行环境

    权威的资料是微软官方的文档:在Ubuntu上安装.NET SDK或.NET运行时

    1、准备工作

    (1) 添加Microsoft包签名密钥

    将Microsoft包签名密钥添加到受信任密钥列表,并添加包存储库。

    > wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
    > sudo dpkg -i packages-microsoft-prod.deb

    (2) unable to resolve host address错误

    执行上面命令,会出现unable to resolve host address错误。通过Xshell进入Ubuntu系统,使用root权限修改resolv.conf,添加Google DNS配置。

    > su
    > password
    > cd /etc
    > vi resolv.conf

    在编辑页面添加下面配置:

    nameserver 8.8.8.8 #google域名服务器
    nameserver 8.8.4.4 #google域名服务器

    然后退出编辑并保存:

    > Esc
    > :x

    2、在Ubuntu中安装.NetCore环境

    (1) 安装.netcore SDK

    > sudo apt-get update; 
      sudo apt-get install -y apt-transport-https && 
      sudo apt-get update && 
      sudo apt-get install -y dotnet-sdk-3.1

    (2) 出现错误

    执行上面命令会出现如下错误:

    Couldn't create temporary file /tmp/apt.conf.sqqT47 for passing config to apt-key

    这是因为找不到文件夹/tmp,解决方法是使用root创建/tmp文件夹,并对其赋权:

    > cd /
    > mkdir tmp
    > chmod 777 /tmp

    (3) 安装.netcore运行时

    > sudo apt-get update; 
      sudo apt-get install -y apt-transport-https && 
      sudo apt-get update && 
      sudo apt-get install -y aspnetcore-runtime-3.1

    3、运行.netcore app

    使用下面命令运行.netcore app:

    dotnet TestConsole.dll

    运行.netcore app时可能会出现“Failed to create CoreCLR, HRESULT: 0x80004005”错误,重新创建并赋权/tmp文件夹即可。

  • 相关阅读:
    穿戴式眼镜显示屏方案
    centos8 shell脚本定时restart workerman问题
    cmake中文文档(一)-编译命令行工具
    Dear ImGui中文文档(一)
    PHP实现布隆过滤算法
    case when的记录
    前端的一些记录
    z-index 弹出元素被原本页面的元素遮挡住
    DevExpress 导出pdf中文不显示或者乱码问题
    DevExpress控件位置的微调
  • 原文地址:https://www.cnblogs.com/xhubobo/p/14605664.html
Copyright © 2011-2022 走看看