專案簡介#
基於 fatedier/frp 原版 frp 內網穿透服務端 frps 的一鍵安裝卸載腳本和 docker 鏡像。支持 Linux 伺服器和 docker 等多種環境安裝部署.
- GitHub stilleshan/frps
- Docker stilleshan/frps
docker image support for X86 and ARM
更新#
- 2024-02-25 更新到新版本,支持 toml 配置文件.
- 2021-05-31 更新國內鏡像方便使用
- 2021-05-31 更新 Linux 一鍵安裝腳本同時支持 X86 和 ARM
- 2021-05-29 更新從
0.36.2
版本起 docker 鏡像同時支持 X86 和 ARM
使用#
由於 frps 服務端需要配置參數,本腳本為原版 frps.toml , 安裝完畢後請自行編輯 frps.toml 配置端口,密碼等相關參數並重啟服務。同時你也可以 fork 本倉庫後自行修改 frps.toml , 在進行一鍵安裝也非常方便。後期也可自行配置 frps.toml 和調整 frps 的版本.
一鍵腳本 (先執行腳本,再自行修改 frps.toml 文件.)#
安裝
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh
# 以下為國內鏡像
wget https://github.ioiox.com/stilleshan/frps/raw/branch/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh
使用
vi /usr/local/frp/frps.toml
# 修改 frps.toml 配置
sudo systemctl restart frps
# 重啟 frps 服務即可生效
卸載
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_uninstall.sh && chmod +x frps_linux_uninstall.sh && ./frps_linux_uninstall.sh
# 以下為國內鏡像
wget https://github.ioiox.com/stilleshan/frps/raw/branch/master/frps_linux_uninstall.sh && chmod +x frps_linux_uninstall.sh && ./frps_linux_uninstall.sh
自定義一鍵腳本 (先 fork 本倉庫,再自行修改 frps.toml 文件後執行腳本.)#
- 首先 fork 本倉庫
- 配置 frps.toml
- 修改 frps_linux_install.sh 腳本
- 修改腳本鏈接
- Push 倉庫到 GitHub
修改 frps_linux_install.sh 腳本#
FRP_VERSION=0.60.0
可根據原版專案更新自行修改為最新版本.
REPO=stilleshan/frps
由於 fork 到你自己的倉庫,需修改stilleshan
為你的 GitHub 帳號 ID.
執行一鍵腳本#
修改以下腳本鏈接中的stilleshan
為你的 GitHub 帳號 ID 後,執行即可.
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh
卸載腳本#
frps_linux_uninstall.sh 卸載腳本為通用腳本,可直接執行,也可同上方式修改鏈接後執行.
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_uninstall.sh && chmod +x frps_linux_uninstall.sh && ./frps_linux_uninstall.sh
frps 相關命令#
sudo systemctl start frps
# 啟動服務
sudo systemctl enable frps
# 開機自啟
sudo systemctl status frps
# 狀態查詢
sudo systemctl restart frps
# 重啟服務
sudo systemctl stop frps
# 停止服務
docker 部署#
為避免因 frps.toml 文件的掛載,格式或者配置的錯誤導致容器無法正常運行並循環重啟。請確保先配置好 frps.toml 後再執行啟動.
先 git clone 本倉庫,並正確配置 frps.toml 文件.
git clone https://github.com/stilleshan/frps
# git clone 本倉庫
git clone https://github.ioiox.com/stilleshan/frps
# 國內鏡像
vi /root/frps/frps.toml
# 配置 frps.toml 文件
啟動容器
docker run -d --name=frps --restart=always \
--network host \
-v /root/frps/frps.toml:/frp/frps.toml \
stilleshan/frps
以上命令 -v 掛載的目錄是以 git clone 本倉庫為例,也可以在任意位置手動創建 frps.toml 文件,並修改命令中的掛載路徑.
服務運行中修改 frps.toml 配置後需重啟 frps 服務.
vi /root/frps/frps.toml
# 修改 frps.toml 配置
docker restart frps
# 重啟 frps 容器即可生效
關於配置
==frps.toml==
bindAddr = "0.0.0.0"
bindPort = 7000
#kcpBindPort = 7000
quicBindPort = 7000
webServer.addr = "0.0.0.0"
webServer.port = 7500
webServer.user = "changeme"
webServer.password = "changeme"
log.to = "./frps.log"
log.level = "info"
log.maxDays = 3
log.disablePrintColor = false
auth.method = "token"
auth.token = "changeme"
allowPorts = [
{ start = 443, end = 5000 }
==frpc.toml==
serverAddr = "changeme"
serverPort = 7000
auth.method = "token"
auth.token = "changeme"
[[proxies]]
name = "FD"
type = "tcp"
localIP = "192.168.100.1"
localPort = 443
remotePort = 443
使用 systemctl 命令來控制 frps#
sudo systemctl start frps
# 啟動frps
sudo systemctl enable frps
# 伺服器開機自動啟動frps
sudo systemctl status frps
# 查看狀態
sudo systemctl restart frps
# 重啟frps
sudo systemctl stop frps
# 停止frps
此文由 Mix Space 同步更新至 xLog
原始鏈接為 https://taikula.cool/posts/tutorial/frp-fu-wu-da-jian