Windows下打包项目成Linux版本

1.在项目的根目录下,按住shift+鼠标右键打开PowerShell

注意:按顺序执行即可,wms是项目名称

cmd
set GOOS=linux
go build wms

2.将项目打包放到Linux系统上
3.找到wcs.service自启动文件的目录,然后右键终端,执行下面命令:

sudo vi /lib/systemd/system/wms.service

将wcs.service的内容粘贴进去,输入 i 进行插入,更改一下项目名称;

[Unit]
Description=wms
After=network-online.target
Wants=network-online.target

[Service]
User=being
Group=being
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
WorkingDirectory=/home/being/wms
ExecStart=/home/being/wms/wms
Restart=always
RestartSec=60s
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=100000000
# processes/threads
LimitNPROC=100000000
# locked memory
LimitMEMLOCK=infinity
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false
LimitCORE=infinity
# 禁用标准输出
#StandardOutput=null
# 禁用错误输出
#StandardError=null

[Install]
WantedBy=multi-user.target

4.输入Esc,输入:wq 按回车键

5. 生效自启动文件
sudo systemctl enable wms

6.输入命令启起wms 启动:start

sudo systemctl restart wms

7.输入命令查看是否启动成功

sudo systemctl status wms

相关推荐

  1. Windows打包项目Linux版本

    2024-05-15 15:44:12       34 阅读
  2. windows 环境docker打包python项目

    2024-05-15 15:44:12       40 阅读
  3. vue项目window编译打包没问题linux编译打包报错

    2024-05-15 15:44:12       24 阅读
  4. go windows环境编译 linux可执行文件

    2024-05-15 15:44:12       53 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-05-15 15:44:12       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-05-15 15:44:12       100 阅读
  3. 在Django里面运行非项目文件

    2024-05-15 15:44:12       82 阅读
  4. Python语言-面向对象

    2024-05-15 15:44:12       91 阅读

热门阅读

  1. Scala编程基础7:模式匹配、隐式转换详解

    2024-05-15 15:44:12       34 阅读
  2. 前端下载文件流

    2024-05-15 15:44:12       31 阅读
  3. 5.14 力扣每日一题 贪心

    2024-05-15 15:44:12       42 阅读
  4. dom驱动和数据驱动的理解

    2024-05-15 15:44:12       38 阅读
  5. Vue学习v-on

    2024-05-15 15:44:12       35 阅读
  6. 连接和断开与服务器的连接

    2024-05-15 15:44:12       28 阅读
  7. uniapp实现拖拽排序+滑动删除功能

    2024-05-15 15:44:12       31 阅读
  8. SQL Server BULK INSERT

    2024-05-15 15:44:12       38 阅读
  9. 常见网络攻击及解决方案

    2024-05-15 15:44:12       33 阅读