赞
踩
本博文的步骤是针对FastTunnel的server端,当然client端或其他基于.NET core的程序都可以参考
===================================
安装dotnet运行时:
-----------------------------------------------------------
添加如下deb(额外的,例如Ubuntu16.04需要设置):
wget https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
-----------------------------------------------------------
正常的:
sudo apt-get update && \
sudo apt-get install -y dotnet-sdk-6.0
sudo apt-get update && \
sudo apt-get install -y aspnetcore-runtime-6.0
sudo apt-get install -y dotnet-runtime-6.0
-----------------------------------------------------------
解压缩文件:
tar -zxvf FastTunnel.Client.linux-x64.tar.gz
-----------------------------------------------------------
===================================
终端前台方式运行(关闭终端或SSH连接后会自动关闭该进程):
dotnet yourapplication.dll
----------------------------------------------------------
后台方式运行(关闭终端或SSH连接后会自动关闭该进程):
dotnet MyApp.dll &
-----------------------------------------------------------
===================================
服务方式运行:
-----------------------------------------------------------
编辑服务运行配置文件
sudo nano /etc/systemd/system/myapp.service
-----------------------------------------------------------
有效的配置
[Unit]
Description=My .NET Core Application
After=network.target
[Service]
User=root
WorkingDirectory=/root/FastTunnel.Server.linux-x64
ExecStart=/usr/bin/dotnet /root/FastTunnel.Server.linux-x64/FastTunnel.Server.dll
Restart=always
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=FastTunnel
[Install]
WantedBy=multi-user.target
-----------------------------------------------------------
生效和运行服务
sudo systemctl daemon-reload # 重载Systemd配置
sudo systemctl enable myapp.service # 设置服务为开机启动
sudo systemctl start myapp.service # 启动服务
sudo systemctl status myapp.service # 检查服务状态
-----------------------------------------------------------
检查日志
journalctl -u fasttunnel.service -e
-----------------------------------------------------------
翻译
搜索
复制
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。