• dotnet应用部署到ubuntu


    1. 下载了个ubuntu16.04的虚拟机,用NAT的网络连接模式,在配置文件中指定了ip地址后还是无效,原来ubuntu desktop用的是network manager里的IP地址,而不是networking服务的

    /etc/network/interfaces
    service networking start

    2.配置apt源

    /etc/apt/sources.list

    sudo apt-get update

    sudo rm /var/lib/apt/lists/lock

     

    # deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
    deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
    deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
    deb http://archive.canonical.com/ubuntu xenial partner
    deb-src http://archive.canonical.com/ubuntu xenial partner
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
    
     
    • 错误
    W: GPG 错误:http://packages.ros.org/ros/ubuntu xenial InRelease: 由于没有公钥,无法验证下列签名: NO_PUBKEY F42ED6FBAB17C654 W: 仓库 “http://packages.ros.org/ros/ubuntu xenial InRelease” 没有数字签名。 N: 无法认证来自该源的数据,所以使用它会带来潜在风险。 N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
    • 解决
    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654
    注意:最后的码,根据不同的电脑进行修改
    Ubuntu下安装deb包需要使用dpkg命令
    sudo dpkg -i <package.deb>
     

    3.开启ssh

    /etc/ssh/ssh_config
    service ssh start
    sudo apt-get install openssh-server

    4.samba

    sudo apt-get install samba
    nano /etc/ samba /smb.conf
    [share]
    workgroup = root
    security = root
    comment = share
    path = /
    browseable = yes
    read only = yes
    writeable = yes

    smbpasswd - a root
    service smbd start

    5.安装dotnet
    sudo rm /var/lib/apt/lists/lock
    sudo rm /var/lib/dpkg/lock
     
    sudo apt-get install -y aspnetcore-runtime-3.1 --fix-missing
    也可以从microsoft网站上下载对应版本文件,放到下面的目录下
     
    6.安装supervisor守护进程
     
    sudo service supervisor stop
    sudo service supervisor start
     
    supervisor开启web端管理,在/etc/supervisor 目录下,打开supervisor.conf 文件,添加如下配置项。
    [inet_http_server] ;HTTP服务器,提供web管理界面
    port=127.0.0.1:9001 ;访问方式IP+端口
    username=admin ;登录时需要身份验证的话,添加用户名和密码
    password=admin123
     
    设置应用配置文件,注意没用sudo的话会报环境变量的错误
    /etc/supervisor/conf.d/abpproject.conf
     
    用supervisord启动会发生如下错误,用service启动就好了
     
    7.修改默认5000端口监听
    var host = new WebHostBuilder()
        .UseKestrel()
        .UseContentRoot(Directory.GetCurrentDirectory())
        .UseUrls("http://localhost:60000", "http://localhost:60001")
        .UseIISIntegration()
        .UseStartup<Startup>()
        .Build();

    或者

    public static IHostBuilder CreateHostBuilder(string[] args) =>
                Host.CreateDefaultBuilder(args)
                    .ConfigureWebHostDefaults(webBuilder =>
                    {
                        var config = new ConfigurationBuilder()
                         .SetBasePath(Directory.GetCurrentDirectory())
                         .AddJsonFile("appsettings.json", optional: true)
                         .Build();
    
                        Console.WriteLine(config["server.urls"]);
                        webBuilder.UseUrls(config["server.urls"]);
                        webBuilder.UseStartup<Startup>();
                        webBuilder.UseSerilog();
                        webBuilder.ConfigureKestrel(options => options.AllowSynchronousIO = true);
                    });

  • 相关阅读:
    Tiling_easy version
    Children’s Queue
    hdu 彼岸
    最小公倍数和最大公约数问题
    hdu 神、上帝以及老天爷
    统计问题
    不容易系列之(3)—— LELE的RPG难题
    hdu 折线分割平面
    hdu Counting Triangles
    Queuing
  • 原文地址:https://www.cnblogs.com/sui84/p/13664150.html
Copyright © 2020-2023  润新知