mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 16:15:49 -06:00
[GH-ISSUE #176] frp怎样开机启动和后台运行? #118
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#118
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @piiiiiiiiiiiiiii on GitHub (Dec 14, 2016).
Original GitHub issue: https://github.com/fatedier/frp/issues/176
两个问题:
1.在centos上如何开机运行?
2.怎样后台运行,而不用一直开着putty
谢谢
已经解决:
二更@20210519
现在下载的frp打包文件目录内,已经写好了后台运行启动文件,比如服务器端,只需要把frps.service复制一份到/etc/systemd/system目录下即可。
如果想自己手写,参照如下:
使用systemd配置开机自启,适用于 centos7 Ubuntu 16 或 debian 8。
vi /etc/systemd/system/frps.service 新建此文件,并写入以下内容
:
[Unit]
Description=frps daemon
[Service]
Type=simple
ExecStart=/usr/bin/frps -c /etc/frps/frps.ini
[Install]
WantedBy=multi-user.target
启动并设为开机自启。
$ systemctl start frps
$ systemctl enable frps
参照:lcbk.net/9766.html
------------centos6.5及以下---------------------
vi /etc/rc.local
在最下面加一行/usr/sbin/frp/frps -c /usr/sbin/frp/frps.ini
其中 /usr/sbin/frp是程序放置的目录,重启ok
@lnzoro commented on GitHub (Dec 14, 2016):
nohup 后台可以用
@wxyzh commented on GitHub (Dec 14, 2016):
supervisor
rc.local
systemd
nohup
@piiiiiiiiiiiiiii commented on GitHub (Dec 14, 2016):
楼上能详细说说吗? @lnzoro @wxyzh
@fatedier commented on GitHub (Dec 14, 2016):
@impig33 建议这一类的问题可以通过搜索引擎自行解决。
@piiiiiiiiiiiiiii commented on GitHub (Dec 14, 2016):
二更@20210519
现在下载的frp打包文件目录内,已经写好了后台运行启动文件,比如服务器端,只需要把frps.service复制一份到/etc/systemd/system目录下即可。
如果想自己手写,参照如下:
已经解决:
使用systemd配置开机自启,适用于 centos7 Ubuntu 16 或 debian 8。
vi /etc/systemd/system/frps.service 新建此文件,并写入以下内容
:
[Unit]
Description=frps daemon
[Service]
Type=simple
ExecStart=/usr/bin/frps -c /etc/frps/frps.ini
[Install]
WantedBy=multi-user.target
启动并设为开机自启。
$ systemctl start frps
$ systemctl enable frps
参照:lcbk.net/9766.html
------------centos6.5及以下---------------------
vi /etc/rc.local
在最下面加一行/usr/sbin/frp/frps -c /usr/sbin/frp/frps.ini
其中 /usr/sbin/frp是程序放置的目录,重启ok
.
@piiiiiiiiiiiiiii commented on GitHub (Dec 14, 2016):
太好用了,使用特权模式服务端免配置,太好用了,谢谢作者。
@vc5 commented on GitHub (Jun 2, 2017):
贴一下我之前无法开机自启frpc的解决办法,原因可能是因为系统开机并未准备好网络,或者其它依赖
sudo vim /etc/systemd/system/frpc.service按如下修改
使用
sudo systemctl enable frpc.service启用@fatedier commented on GitHub (Jun 2, 2017):
@vc5 👍
也可以试试 0.11.0 frpc 新增的 login_fail_exit 参数设置为 false,这样启动时没连上服务器就不会自动退出了,而是每隔30s自动重连。
@leke2015 commented on GitHub (Jul 8, 2017):
http://free-e.net/109 这篇文章能帮助到您。
@the-eric-kwok commented on GitHub (Dec 7, 2017):
If you don't have systemd or your kernel don't support systemd, this is my init.d service file:
Hope this can help you.
Oh, by the way, you should put the binary into
/usr/binand put the config file into/etc/frp/@ihipop commented on GitHub (Aug 24, 2018):
This Version Allow run as
nobodyAND ports below 1024/etc/systemd/system/frps.service
Systems that has
AmbientCapabilitiessupport (usually kernel >= linux4.3)Systems that without
AmbientCapabilitiessupport,You needapt install libcap2-binthen/etc/systemd/system/frpc.service
Config
Also Archived at https://gist.github.com/ihipop/4dc607caef7c874209521b10d18e35af
@popy32 commented on GitHub (Feb 13, 2019):
centos 6.5 init.d script
centos 6.5 客户端环境下配置后台自启
inspire by
https://serverfault.com/a/869143
https://github.com/utobi/prometheus-rpm/blob/master/node_exporter/contrib/node_exporter.init
ensure binary in
/usr/bin/frpc, and configure file in/etc/frp/frpc.iniedit
/etc/init.d/frpcandchkconfig add frpcin server with ubuntu 16.04, systemd is available
cat /etc/systemd/system/frps.service
@qiushile commented on GitHub (Nov 17, 2022):
万分感谢!!!