linux部署dotnet runtime
登录linux,创建安装目录
一般放在 /opt/dotnet(标准的第三方程序安装目录):sudo mkdir -p /opt/dotnet下载并解压 runtime 文件
cd /opt/dotnetsudo wget https://builds.dotnet.microsoft.com/dotnet/Runtime/6.0.36/dotnet-runtime-6.0.36-linux-x64.tar.gz
或者(使用xftp上传dotnet-runtime-6.0.36-linux-x64.tar.gz)sudo tar -xzvf dotnet-runtime-6.0.36-linux-x64.tar.gzsudo rm dotnet-runtime-6.0.36-linux-x64.tar.gz配置环境变量
sudo ln -s /opt/dotnet/dotnet /usr/local/bin/dotnet验证安装
dotnet --info
dotnet 程序自包含模式操作流程
发布命令:
dotnet publish -c Release -r linux-x64 -o publish/linux-x64 --self-contained truepausefilezilla上传后cd到指定目录:
cd /var/www/game-admin/linux-x64进入程序目录并设置执行权限:
chmod +x GameConsoleAdmin./GameConsoleAdmin运行程序
直接运行。Xshell关闭后进程也会关闭./GameConsoleAdmin
后台运行。Xshell关闭后不会关闭进程nohup ./GameConsoleAdmin> output.log 2>&1 &
Linux中关闭程序的命令
找到pid
ps aux | grep GameConsoleAdmin
或者:pgrep -fl GameConsoleAdmin
找到pid,然后运行kill pid
如果程序没有响应,再使用强制方式:kill -9 pid一键杀掉系统中叫GameConsoleAdmin
pkill -f GameConsoleAdmin