linux 安装 frpc 并设置自启动服务

安装

https://github.com/fatedier/frp/releases/ 下载 linux 包,解压到 /opt 目录,编辑 frpc.ini

[common]
token = xxxxx
server_addr = domain.com
server_port = 65001
admin_addr = 0.0.0.0
admin_port = 65000
admin_user = admin
admin_pwd = admin

[admin]
local_ip=127.0.0.1
local_port=65000
remote_port=59000

添加到服务

在路径 /usr/lib/systemd/system 下添加文件 frpc.service ,内容如下:

[Unit]
Description=Frp Client Service
After=network.target

[Service]
Type=simple
User=nobody
Restart=on-failure
RestartSec=5s
ExecStart=/opt/frpc -c /opt/frpc.ini
ExecReload=/opt/frpc -reload -c /opt/frpc.ini

[Install]
WantedBy=multi-user.target

启动服务:

systemctl enable frpc
systemctl start frpc