编写文件:
vim /etc/systemd/system/frps.service
粘贴以下内容(可根据你实际路径修改):
[Unit] Description=FRP Server Service After=network.target [Service] Type=simple ExecStart=/root/frp/frps -c /root/frp/frps.toml Restart=on-failure User=root WorkingDirectory=/root/frp [Install] WantedBy=multi-user.target
依次执行以下命令设为开机启动:
# 重新加载 systemd 配置 sudo systemctl daemon-reexec sudo systemctl daemon-reload # 启动服务 sudo systemctl start frps # 设置开机启动 sudo systemctl enable frps # 查看服务状态 sudo systemctl status frps