转载自:https://github.frytea.com/stilleshan/frpc#linux-服务器-一键脚本安装
安装
wget https://raw.githubusercontent.com/stilleshan/frpc/master/frpc_linux_install.sh && chmod +x frpc_linux_install.sh && ./frpc_linux_install.sh
使用
vi /usr/local/frp/frpc.ini
# 修改 frpc.ini 配置
sudo systemctl restart frpc
# 重启 frpc 服务即可生效
卸载
wget https://raw.githubusercontent.com/stilleshan/frpc/master/frpc_linux_uninstall.sh && chmod +x frpc_linux_uninstall.sh && ./frpc_linux_uninstall.sh
#!/bin/sh
FRP_VERSION="0.35.1"
REPO="stilleshan/frpc"
WORK_PATH=$(dirname $(readlink -f $0))
# 创建frp文件夹
mkdir -p /usr/local/frp && \
# 下载并移动frpc文件
wget -P ${WORK_PATH} https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/frp_${FRP_VERSION}_linux_amd64.tar.gz && \
tar -zxvf frp_${FRP_VERSION}_linux_amd64.tar.gz && \
cd frp_${FRP_VERSION}_linux_amd64 && \
mv frpc /usr/local/frp && \
# 下载frpc.in和frpc.service
wget -P /usr/local/frp https://raw.githubusercontent.com/${REPO}/master/frpc.ini && \
wget -P /lib/systemd/system https://raw.githubusercontent.com/${REPO}/master/frpc.service && \
systemctl daemon-reload && \
# 启动frpc
sudo systemctl start frpc && \
sudo systemctl enable frpc && \
# 删除多余文件
cd ${WORK_PATH} && \
rm -rf frp_${FRP_VERSION}_linux_amd64 frp_${FRP_VERSION}_linux_amd64.tar.gz frpc_linux_install.sh
echo "=======================================================" &&\
echo -e "\033[32m安装成功,请先修改 frpc.ini 文件,确保格式及配置正确无误!\033[0m" && \
echo -e "\033[31mvi /usr/local/frp/frpc.ini \033[0m" && \
echo -e "\033[32m修改完毕后执行以下命令重启服务:\033[0m" && \
echo -e "\033[31msudo systemctl restart frpc\033[0m" && \
echo "======================================================="