debian使用 systemctl 且自启frp

it2022-05-05  152

debian 系统无法使用 systemctl

首先root模式下: apt install systemd-sysv && reboot 就行了

frp安装:

作者:ios122 链接:https://www.jianshu.com/p/b31ad0a5e676 来源:简书 简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

配制 frp 服务器端 – frps frp 的服务器端,一般名字是 frps,配置文件是 frps.ini. 这两个文件要放到你的公网服务器上.一般,你都应去https://link.jianshu.com/?t=https://github.com/fatedier/frp/releases,去寻找 frp 的对应的操作系统的最新下载版本.此处以 frp_0.13.0_linux_amd64.tar.gz 为例.

# 下载.下载地址可以在github发布页右键点击某个下载项 --> 复制链接地址. wget https://github.com/fatedier/frp/releases/download/v0.13.0/frp_0.13.0_linux_amd64.tar.gz # 解压. tar -zxvf frp_0.13.0_linux_amd64.tar.gz # cd 到 frp 目录. cd frp_0.13.0_linux_amd64 # 编辑.debian上,打开vim的命令是 vi,不是 vim. vi frps.ini

在 frps.ini 中输入:

[common] bind_port = 7000 vhost_http_port =80 dashboard_port = dashboard_port_number dashboard_user = dashboard_user_name dashboard_pwd = dashboard_pwd_value privilege_token = privilege_token_value

开启

./frps -c ./frps.ini

配置自启动

首先创建服务( frps.service): sudo nano /lib/systemd/system/frps.service 在frps.service里写入以下内容

[Unit] Description=fraps service After=network.target network-online.target syslog.target Wants=network.target network-online.target [Service] Type=simple #启动服务的命令(此处写你的frps的实际安装目录) ExecStart=[/your/path]/frps -c [/your/path]/frps.ini [Install] WantedBy=multi-user.target

然后启动 frps

sudo systemctl start frps

再打开自启动

sudo systemctl enable frps

同时

重启: sudo systemctl restart frps 停止 :sudo systemctl stop frps 查看应用日志: sudo systemctl status frps

[Service] Restart=always RestartSec=5

之后,kill 掉frpc后会自动重启

客户端自启动配置类似。

systemctl命令管理systemd的资源Unit systemd的Unit放在目录/usr/lib/systemd/system(Centos)或/etc/systemd/system(Ubuntu)


最新回复(0)