CentOS7之部署.Net Core

CentOS7之部署.Net Core

.Net Core是跨平台的,这里记录centos7下安装.net core 3.1,详细教程官网已经给出

  • 安装

    sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
    sudo yum update
    sudo yum install dotnet-sdk-3.1
    
  • 验证

     dotnet --version
    
  • 部署服务

    • 服务文件:dotnet.service

      [Unit]
      Description=Server running on Linux
      
      [Service]
      WorkingDirectory=/root/xxx
      ExecStart=/usr/bin/xxx.dll
      Restart=always
      # Restart service after 10 seconds if the dotnet service crashes:
      RestartSec=10
      KillSignal=SIGINT
      SyslogIdentifier=id
      User=root
      Environment=ParamName=ParamValue
      
      [Install]
      WantedBy=multi-user.target
      
    • 注册服务

      sudo systemctl enable dotnet.service
      
    • 启动服务

      sudo systemctl start dotnet.service
      
posted @ 2021-01-18 07:12  shadowxs  阅读(80)  评论(0编辑  收藏  举报