Linux 服务器 一键脚本安装

本脚本目前同时支持 Linux X86 和 ARM 架构

1.安装

wget https://raw.githubusercontent.com/stilleshan/frpc/master/frpc_linux_install.sh && chmod +x frpc_linux_install.sh && ./frpc_linux_install.sh

国内 gitee 镜像

wget https://gitee.com/stilleshan/frpc/raw/master/frpc_linux_install.sh && chmod +x frpc_linux_install.sh && ./frpc_linux_install.sh

2.使用

修改 frpc.ini 配置

vi /usr/local/frp/frpc.ini

重启 frpc 服务即可生效

sudo systemctl restart frpc

3.卸载

wget https://raw.githubusercontent.com/stilleshan/frpc/master/frpc_linux_uninstall.sh && chmod +x frpc_linux_uninstall.sh && ./frpc_linux_uninstall.sh

国内 gitee 镜像

wget https://gitee.com/stilleshan/frpc/raw/master/frpc_linux_uninstall.sh && chmod +x frpc_linux_uninstall.sh && ./frpc_linux_uninstall.sh

Linux 服务器 docker 安装

为避免因 frpc.ini 文件的挂载,格式或者配置的错误导致容器无法正常运行并循环重启.请确保先配置好 frpc.ini 后在运行启动
先 git clone 本仓库,并正确配置 frpc.ini 文件

1.git clone 本仓库 gitee 镜像

git clone https://gitee.com/stilleshan/frpc.git

2.配置 frpc.ini 文件

vi /root/frpc/frpc.ini

3.执行以下命令启动服务

docker run -d --name=frpc --restart=always -v /root/frpc/frpc.ini:/frp/frpc.ini stilleshan/frpc

以上命令 -v 挂载的目录是以 git clone 本仓库为例,也可以在任意位置手动创建 frpc.ini 文件,并修改命令中的挂载路径.

4.服务运行中修改 frpc.ini 配置后需重启 frpc 服务

修改 frpc.ini 配置

vi /root/frp/frpc.ini

重启 frpc 容器即可生效

docker restart frpc

使用systemctl来控制frp的启动

frp 的安装查看

udo vim /lib/systemd/system/frps.service

服务端

sudo vi /lib/systemd/system/frps.service
[Unit]
Description=fraps service
After=network.target syslog.target
Wants=network.target

[Service]
Type=simple
#启动服务的命令(此处写你的frps的实际安装目录)
ExecStart=/opt/soft/frp/frp_0.33.0_linux_amd64/frps -c /opt/soft/frp/frp_0.33.0_linux_amd64/frps.ini 

[Install]
WantedBy=multi-user.target

客户端

sudo vi /lib/systemd/system/frpc.service
[Unit]
Description=frpc service
After=network.target syslog.target
Wants=network.target

[Service]
Type=simple
启动服务的命令(此处写你的frpc的实际安装目录)

ExecStart=/opt/soft/frp/frp_0.33.0_linux_amd64/frpc -c /opt/soft/frp/frp_0.33.0_linux_amd64/frpc.ini

[Install]
WantedBy=multi-user.target

服务端frps的启动与停止

启动frps

sudo systemctl start frps 

打开自启动

sudo systemctl enable frps

重启应用

sudo systemctl restart frps

停止应用

sudo systemctl stop frps

查看应用的日志

sudo systemctl status frps

停止开机自启动

systemctl disable frps

服务端frpc的启动与停止
启动frpc

sudo systemctl start frpc 

打开自启动

sudo systemctl enable frpc

重启应用

sudo systemctl restart frpc

停止应用

sudo systemctl stop frpc

查看应用的日志

sudo systemctl

停止开机自启动

systemctl disable frpc

查看frp线程

ps -aux | grep frp
Last modification:October 31st, 2021 at 10:35 am
如果觉得我的文章对你有用,请随意赞赏