60 Commits

Author SHA1 Message Date
Stille
f6d1c7bbdc update v0.67.0 2026-01-31 15:11:53 +08:00
Stille
d67372ef7e update v0.66.0 2026-01-05 16:27:48 +08:00
Stille
dc6a23a429 update v0.65.0 2025-09-27 22:13:47 +08:00
Stille
d4e5ebd552 update v0.64.0 2025-08-11 14:03:34 +08:00
Stille
dceede8f90 fixed ghproxy 2025-07-23 14:05:10 +08:00
Stille
8e6d7f1c55 update v0.63.0 2025-06-27 20:05:42 +08:00
Stille
7a72eceed2 update v0.62.1 2025-04-28 14:53:07 +08:00
Stille
0e0dd2e351 update github proxy 2025-04-20 12:42:02 +08:00
Stille
2a509c705d update v0.62.0 2025-04-17 13:45:23 +08:00
Stille
df57ec880b update v0.61.2 2025-03-07 19:58:46 +08:00
Stille
16a0ff1e37 update shell 2024-12-17 10:33:00 +08:00
Stille
0938ed77cc update v0.61.1 2024-12-17 10:24:44 +08:00
Stille
29182c91e1 update v0.61.0 2024-10-18 13:36:25 +08:00
Stille
ca4c26e337 update v0.60.0 2024-08-19 14:02:32 +08:00
Stille
68154aa439 update v0.59.0 2024-07-09 11:17:15 +08:00
Stille
5dfdba514b update v0.58.1 2024-06-01 10:15:28 +08:00
Stille
3fb39265e4 update v0.58.0 2024-05-08 12:59:22 +08:00
Stille
5ff08b16db update v0.57.0 2024-04-09 12:03:49 +08:00
Stille
1b6859bc22 update v0.56.0 2024-03-22 12:35:59 +08:00
Stille
3b456101af update for v0.55.1 2024-03-19 18:16:57 +08:00
Stille
ab182ac07b update v5.4.0 for frps 2024-02-24 13:05:32 +08:00
Stille
d747cf3362 Revert "更改仓库地址"
This reverts commit 9e6da70896.
2024-02-24 12:54:57 +08:00
Stille
ea5731efe1 Revert "更改仓库源"
This reverts commit 2d47c7afd7.
2024-02-24 12:54:37 +08:00
Stille
af70f0ee13 Merge pull request #5 from shenyunet/master
更新到最新版本并支持toml
2024-02-24 12:48:40 +08:00
shenyunet
9e6da70896 更改仓库地址 2024-02-24 01:11:49 +08:00
shenyunet
2d47c7afd7 更改仓库源 2024-02-24 01:10:06 +08:00
shenyunet
05650ccde0 更新到最新版本并支持toml 2024-02-24 01:06:02 +08:00
Stille
c29f2bd24c update v0.51.3 2023-08-17 09:13:22 +08:00
Stille
c7dba07284 update v0.51.2 2023-07-26 09:20:11 +08:00
Stille
be7f2a573e update v0.51.1 2023-07-21 09:17:04 +08:00
Stille
db00fb9582 update v0.51.0 2023-07-07 10:52:36 +08:00
Stille
5bc4bf4eba update v0.50.0 2023-06-26 17:22:03 +08:00
Stille
9f43d1d066 update v0.49.0 2023-05-29 08:36:08 +08:00
Stille
bf82718a43 update v0.48.0 2023-03-08 13:38:48 +08:00
Stille
e2c4355c58 update v0.47.0 2023-02-10 12:05:26 +08:00
Stille
6ee2438eab update v0.46.1 2023-01-10 10:52:56 +08:00
Stille
3064b3a89a update v0.46.0 2022-12-19 16:49:20 +08:00
Stille
f9c5d4bb05 update v0.45.0 2022-10-27 11:07:02 +08:00
Stille
675804cb2f update v0.44.0 2022-07-11 10:25:15 +08:00
Stille
d52be2b3c5 update v0.43.0 2022-05-27 17:59:02 +08:00
Stille
fca0fdcc95 update v0.42.0 2022-04-22 11:58:43 +08:00
Stille
2e8511aa42 update v0.41.0 2022-03-24 09:44:10 +08:00
Stille
b075d994ef update v0.40.0 2022-03-12 09:28:44 +08:00
Stille
937273d17e optimize 2022-02-15 10:38:08 +08:00
Stille
cea9393d27 Update v0.39.1 2022-02-09 17:40:34 +08:00
Stille
dee8e0d071 Update v0.39.0 2022-02-08 23:59:15 +08:00
Stille
8b122d3347 Update v0.38.0 2021-10-26 11:06:02 +08:00
Stille
86e48dd056 Update v0.37.1 2021-08-04 21:26:09 +08:00
Stille
d87b289f46 Update v0.37.0 2021-06-03 17:41:19 +08:00
Stille
09426798d0 Update optimize shell script for Linux X86 and ARM 2021-05-31 14:51:40 +08:00
Stille
1528d0de48 Update docker support for ARM 2021-05-31 11:17:54 +08:00
Stille
5c8c7fccc9 Optimize Time Zone 2021-05-08 11:58:35 +08:00
Stille
fe1bab0e20 Update v0.36.2 2021-03-22 15:32:34 +08:00
Stille
caf5d45c59 Update v0.36.1 2021-03-18 21:06:04 +08:00
Stille
a1e065f4e8 Update v0.36.0 2021-03-17 20:07:27 +08:00
Stille
45a27889ec Update v0.35.1 2021-01-25 17:41:32 +08:00
Stille
9c68a37cd8 Update v0.35.0 2021-01-19 23:35:27 +08:00
Stille
d7201a5ba8 Update v0.34.3 2020-11-21 09:57:55 +08:00
Stille
40b9f0db0b Update v0.34.2 2020-11-13 18:07:48 +08:00
Stille
5fe02605a2 Update v0.34.1 2020-10-10 10:51:28 +08:00
8 changed files with 329 additions and 108 deletions

View File

@@ -0,0 +1,72 @@
name: "docker build release"
on:
push:
workflow_dispatch:
env:
PROJECT: frps
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.5
- name: Set tag
id: tag
run: |
if [[ -n $(cat Dockerfile | awk '{if($1~"ENV" && $2=="VERSION")print $3}') ]]; then
VERSION=$(cat Dockerfile | awk '{if($1~"ENV" && $2=="VERSION")print $3}')
echo "tag=$VERSION" >> $GITHUB_ENV
else
echo "tag=$(date +%Y)-$(date +%m)-$(date +%d)" >> $GITHUB_ENV
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push to docker hub
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/${{ env.PROJECT }}:latest
${{ secrets.DOCKER_USERNAME }}/${{ env.PROJECT }}:${{ env.tag }}
- name: Sync README.md to Docker Hub
uses: ms-jpq/sync-dockerhub-readme@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: ${{ secrets.DOCKER_USERNAME }}/${{ env.PROJECT }}
readme: "./README.md"
- name: Login harbor
uses: docker/login-action@v1
with:
registry: ${{ secrets.HARBOR_REGISTRY }}
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASSWORD }}
- name: Build and push to harbor
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.HARBOR_REGISTRY }}/${{ secrets.HARBOR_USERNAME }}/${{ env.PROJECT }}:latest
${{ secrets.HARBOR_REGISTRY }}/${{ secrets.HARBOR_USERNAME }}/${{ env.PROJECT }}:${{ env.tag }}

View File

@@ -1,18 +1,27 @@
FROM alpine:3.8 FROM alpine:3.8
MAINTAINER Stille <stille@ioiox.com> LABEL maintainer="Stille <stille@ioiox.com>"
ENV VERSION 0.67.0
ENV TZ=Asia/Shanghai
WORKDIR / WORKDIR /
ENV FRP_VERSION 0.34.0
RUN set -x && \ RUN apk add --no-cache tzdata \
wget --no-check-certificate https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/frp_${FRP_VERSION}_linux_amd64.tar.gz && \ && ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \
tar xzf frp_${FRP_VERSION}_linux_amd64.tar.gz && \ && echo ${TZ} > /etc/timezone
cd frp_${FRP_VERSION}_linux_amd64 && \
mkdir /frp && \ RUN if [ "$(uname -m)" = "x86_64" ]; then export PLATFORM=amd64 ; \
mv frps frps.ini /frp && \ elif [ "$(uname -m)" = "aarch64" ]; then export PLATFORM=arm64 ; \
cd .. && \ elif [ "$(uname -m)" = "armv7" ]; then export PLATFORM=arm ; \
rm -rf *.tar.gz frp_${FRP_VERSION}_linux_amd64 elif [ "$(uname -m)" = "armv7l" ]; then export PLATFORM=arm ; \
elif [ "$(uname -m)" = "armhf" ]; then export PLATFORM=arm ; fi \
&& wget --no-check-certificate https://github.com/fatedier/frp/releases/download/v${VERSION}/frp_${VERSION}_linux_${PLATFORM}.tar.gz \
&& tar xzf frp_${VERSION}_linux_${PLATFORM}.tar.gz \
&& cd frp_${VERSION}_linux_${PLATFORM} \
&& mkdir /frp \
&& mv frps frps.toml /frp \
&& cd .. \
&& rm -rf *.tar.gz frp_${VERSION}_linux_${PLATFORM}
VOLUME /frp VOLUME /frp
CMD /frp/frps -c /frp/frps.ini CMD /frp/frps -c /frp/frps.toml

View File

@@ -4,20 +4,29 @@
- GitHub [stilleshan/frps](https://github.com/stilleshan/frps) - GitHub [stilleshan/frps](https://github.com/stilleshan/frps)
- Docker [stilleshan/frps](https://hub.docker.com/r/stilleshan/frps) - Docker [stilleshan/frps](https://hub.docker.com/r/stilleshan/frps)
> *docker image support for X86 and ARM*
## 使用说明 ## 更新
由于 frps 服务端需要配置参数,本脚本为原版 frps.ini ,安装完毕后请自行编辑 frps.ini 配置端口,密码等相关参数并重启服务.同时你也可以 fork 本仓库后自行修改 frps.ini ,在进行一键安装也非常方便.后期也可自行配置 frps.ini 和调整 frps 的版本. - **2024-02-25** 更新到新版本,支持 toml 配置文件.
- **2021-05-31** 更新国内镜像方便使用
- **2021-05-31** 更新 Linux 一键安装脚本同时支持 X86 和 ARM
- **2021-05-29** 更新从`0.36.2`版本起 docker 镜像同时支持 X86 和 ARM
### 一键脚本(先运行脚本,在自行修改 frps.ini 文件.) ## 使用
由于 frps 服务端需要配置参数,本脚本为原版 frps.toml ,安装完毕后请自行编辑 frps.toml 配置端口,密码等相关参数并重启服务.同时你也可以 fork 本仓库后自行修改 frps.toml ,在进行一键安装也非常方便.后期也可自行配置 frps.toml 和调整 frps 的版本.
### 一键脚本(先执行脚本,在自行修改 frps.toml 文件.)
安装 安装
```shell ```shell
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh
# 以下为国内镜像
wget https://ghfast.top/https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh
``` ```
使用 使用
```shell ```shell
vi /usr/local/frp/frps.ini vi /usr/local/frp/frps.toml
# 修改 frps.ini 配置 # 修改 frps.toml 配置
sudo systemctl restart frps sudo systemctl restart frps
# 重启 frps 服务即可生效 # 重启 frps 服务即可生效
``` ```
@@ -25,26 +34,28 @@ sudo systemctl restart frps
卸载 卸载
```shell ```shell
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_uninstall.sh && chmod +x frps_linux_uninstall.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
# 以下为国内镜像
wget https://ghfast.top/https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_uninstall.sh && chmod +x frps_linux_uninstall.sh && ./frps_linux_uninstall.sh
``` ```
### 自定义一键脚本(先 fork 本仓库,在自行修改 frps.toml 文件后执行脚本.)
### 自定义一键脚本(先 fork 本仓库,在自行修改 frps.ini 文件后运行脚本.)
- 首先 fork 本仓库 - 首先 fork 本仓库
- 配置 frps.ini - 配置 frps.toml
- 修改 frps_linux_install.sh 脚本 - 修改 frps_linux_install.sh 脚本
- 修改脚本链接并运行 - 修改脚本链接
- Push 仓库到 GitHub
#### 修改 frps_linux_install.sh 脚本 #### 修改 frps_linux_install.sh 脚本
`FRP_VERSION="0.30.0"` 可根据原版项目更新自行修改为最新版本 `FRP_VERSION=0.67.0` 可根据原版项目更新自行修改为最新版本.
`REPO="stilleshan/frps"` 由于 **fork** 到你自己的仓库,需修改`stilleshan`为你的GitHub账号ID. `REPO=stilleshan/frps` 由于 **fork** 到你自己的仓库,需修改`stilleshan`为你的 GitHub 账号ID.
#### 行一键脚本 #### 行一键脚本
修改以下脚本链接中的`stilleshan`为你的GitHub账号ID后,行即可. 修改以下脚本链接中的`stilleshan`为你的 GitHub 账号 ID 后,行即可.
```shell ```shell
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh 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 卸载脚本为通用脚本,可直接行,也可同上方式修改链接后行. frps_linux_uninstall.sh 卸载脚本为通用脚本,可直接行,也可同上方式修改链接后行.
```shell ```shell
wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_uninstall.sh && chmod +x frps_linux_uninstall.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
``` ```
@@ -64,43 +75,38 @@ sudo systemctl stop frps
``` ```
### docker 部署 ### docker 部署
为避免因 **frps.ini** 文件的挂载,格式或者配置的错误导致容器无法正常运行并循环重启.请确保先配置好 **frps.ini** 后在行启动. 为避免因 **frps.toml** 文件的挂载,格式或者配置的错误导致容器无法正常运行并循环重启.请确保先配置好 **frps.toml** 后在行启动.
**git clone** 本仓库,并正确配置 **frps.ini** 文件. **git clone** 本仓库,并正确配置 **frps.toml** 文件.
```shell ```shell
git clone https://github.com/stilleshan/frps.git git clone https://github.com/stilleshan/frps
# git clone 本仓库 # git clone 本仓库
vi /root/frps/frps.ini git clone https://ghfast.top/https://github.com/stilleshan/frps
# 配置 frps.ini 文件 # 国内镜像
vi /root/frps/frps.toml
# 配置 frps.toml 文件
``` ```
自行使用 **-p** 参数映射服务端所需端口,执行以下命令启动服务. 启动容器
```shell ```shell
docker run -d --name=frps --restart=always \ docker run -d --name=frps --restart=always \
-v /root/frps/frps.ini:/frp/frps.ini \ --network host \
-p 80:80 \ -v /root/frps/frps.toml:/frp/frps.toml \
-p 443:443 \
-p 7000:7000 \
-p 7500:7500 \
stilleshan/frps stilleshan/frps
``` ```
> 以上命令 -v 挂载的目录是以 git clone 本仓库为例,也可以在任意位置手动创建 frps.ini 文件,并修改命令中的挂载路径. > 以上命令 -v 挂载的目录是以 git clone 本仓库为例,也可以在任意位置手动创建 frps.toml 文件,并修改命令中的挂载路径.
服务运行中修改 **frps.ini** 配置后需重启 **frps** 服务. 服务运行中修改 **frps.toml** 配置后需重启 **frps** 服务.
```shell ```shell
vi /root/frps/frps.ini vi /root/frps/frps.toml
# 修改 frps.ini 配置 # 修改 frps.toml 配置
docker restart frps docker restart frps
# 重启 frps 容器即可生效 # 重启 frps 容器即可生效
``` ```
## 版本更新 ## 链接
- latest 为最新版
- Tags 为历史版本
## 相关链接
更多frp相关信息可参考我的博客
- Blog [www.ioiox.com](https://www.ioiox.com) - Blog [www.ioiox.com](https://www.ioiox.com)
- GitHub [stilleshan/frps](https://github.com/stilleshan/frps) - GitHub [stilleshan/frps](https://github.com/stilleshan/frps)
- Docker [stilleshan/frps](https://hub.docker.com/r/stilleshan/frps) - Docker Hub [stilleshan/frps](https://hub.docker.com/r/stilleshan/frps)
- Docker [docker.ioiox.com](https://docker.ioiox.com)
- 原版frp项目 [fatedier/frp](https://github.com/fatedier/frp) - 原版frp项目 [fatedier/frp](https://github.com/fatedier/frp)
- [CentOS 7 安装配置frp内网穿透服务器端教程](https://www.ioiox.com/archives/5.html) - [CentOS 7 安装配置frp内网穿透服务器端教程](https://www.ioiox.com/archives/5.html)

View File

@@ -1,21 +0,0 @@
[common]
bind_addr = 0.0.0.0
bind_port = 7000
bind_udp_port = 7001
kcp_bind_port = 7000
vhost_http_port = 80
vhost_https_port = 443
dashboard_addr = 0.0.0.0
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = admin
log_file = ./frps.log
log_level = info
log_max_days = 3
disable_log_color = false
token = 12345678
allow_ports = 2000-3000,3001,3003,4000-50000
max_pool_count = 5
max_ports_per_client = 0
subdomain_host = frps.com
tcp_mux = true

View File

@@ -7,7 +7,7 @@ Wants=network.target
Type=simple Type=simple
Restart=on-failure Restart=on-failure
RestartSec=5s RestartSec=5s
ExecStart=/usr/local/frp/frps -c /usr/local/frp/frps.ini ExecStart=/usr/local/frp/frps -c /usr/local/frp/frps.toml
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

35
frps.toml Normal file
View File

@@ -0,0 +1,35 @@
bindAddr = "0.0.0.0"
bindPort = 7000
#kcpBindPort = 7000
quicBindPort = 7000
vhostHTTPPort = 80
vhostHTTPSPort = 443
transport.maxPoolCount = 2000
transport.tcpMux = true
transport.tcpMuxKeepaliveInterval = 60
transport.tcpKeepalive = 7200
transport.tls.force = false
webServer.addr = "0.0.0.0"
webServer.port = 7500
webServer.user = "admin"
webServer.password = "admin"
webServer.pprofEnable = false
log.to = "./frps.log"
log.level = "info"
log.maxDays = 3
log.disablePrintColor = false
auth.method = "token"
auth.token = "12345678"
allowPorts = [
{ start = 10001, end = 50000 }
]
maxPortsPerClient = 8
udpPacketSize = 1500
natholeAnalysisDataReserveHours = 168

View File

@@ -1,28 +1,128 @@
#!/bin/sh #!/usr/bin/env bash
FRP_VERSION="0.33.0" PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
REPO="stilleshan/frps" export PATH
WORK_PATH=$(dirname $(readlink -f $0))
# 创建frp文件夹 # fonts color
mkdir -p /usr/local/frp && \ Green="\033[32m"
# 下载并移动frps文件 Red="\033[31m"
wget -P ${WORK_PATH} https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/frp_${FRP_VERSION}_linux_amd64.tar.gz && \ Yellow="\033[33m"
tar -zxvf frp_${FRP_VERSION}_linux_amd64.tar.gz && \ GreenBG="\033[42;37m"
cd frp_${FRP_VERSION}_linux_amd64 && \ RedBG="\033[41;37m"
mv frps /usr/local/frp && \ Font="\033[0m"
# 下载frps.in和frps.service # fonts color
wget -P /usr/local/frp https://raw.githubusercontent.com/${REPO}/master/frps.ini && \
wget -P /lib/systemd/system https://raw.githubusercontent.com/${REPO}/master/frps.service && \ # variable
systemctl daemon-reload && \ FRP_VERSION=0.67.0
# 启动frps REPO=stilleshan/frps
sudo systemctl start frps && \ WORK_PATH=$(dirname $(readlink -f $0))
sudo systemctl enable frps && \ FRP_NAME=frps
# 删除多余文件 FRP_PATH=/usr/local/frp
cd ${WORK_PATH} && \ PROXY_URL="https://ghfast.top/"
rm -rf frp_${FRP_VERSION}_linux_amd64 frp_${FRP_VERSION}_linux_amd64.tar.gz frps_linux_install.sh
echo "=======================================================" &&\ # check frps
echo -e "\033[32m安装成功,请先修改 frps.ini 文件,确保格式及配置正确无误!\033[0m" && \ if [ -f "/usr/local/frp/${FRP_NAME}" ] || [ -f "/usr/local/frp/${FRP_NAME}.toml" ] || [ -f "/lib/systemd/system/${FRP_NAME}.service" ];then
echo -e "\033[31mvi /usr/local/frp/frps.ini \033[0m" && \ echo -e "${Green}=========================================================================${Font}"
echo -e "\033[32m修改完毕后执行以下命令重启服务:\033[0m" && \ echo -e "${RedBG}当前已退出脚本.${Font}"
echo -e "\033[31msudo systemctl restart frps\033[0m" && \ echo -e "${Green}检查到服务器已安装${Font} ${Red}${FRP_NAME}${Font}"
echo "=======================================================" echo -e "${Green}请手动确认和删除${Font} ${Red}/usr/local/frp/${Font} ${Green}目录下的${Font} ${Red}${FRP_NAME}${Font} ${Green}${Font} ${Red}/${FRP_NAME}.toml${Font} ${Green}文件以及${Font} ${Red}/lib/systemd/system/${FRP_NAME}.service${Font} ${Green}文件,再次执行本脚本.${Font}"
echo -e "${Green}参考命令如下:${Font}"
echo -e "${Red}rm -rf /usr/local/frp/${FRP_NAME}${Font}"
echo -e "${Red}rm -rf /usr/local/frp/${FRP_NAME}.toml${Font}"
echo -e "${Red}rm -rf /lib/systemd/system/${FRP_NAME}.service${Font}"
echo -e "${Green}=========================================================================${Font}"
exit 2
fi
while ! test -z "$(ps -A | grep -w ${FRP_NAME})"; do
FRPSPID=$(ps -A | grep -w ${FRP_NAME} | awk 'NR==1 {print $1}')
kill -9 $FRPSPID
done
# check pkg
if type apt-get >/dev/null 2>&1 ; then
if ! type wget >/dev/null 2>&1 ; then
apt-get install wget -y
fi
if ! type curl >/dev/null 2>&1 ; then
apt-get install curl -y
fi
fi
if type yum >/dev/null 2>&1 ; then
if ! type wget >/dev/null 2>&1 ; then
yum install wget -y
fi
if ! type curl >/dev/null 2>&1 ; then
yum install curl -y
fi
fi
# check network
GOOGLE_HTTP_CODE=$(curl -o /dev/null --connect-timeout 5 --max-time 8 -s --head -w "%{http_code}" "https://www.google.com")
PROXY_HTTP_CODE=$(curl -o /dev/null --connect-timeout 5 --max-time 8 -s --head -w "%{http_code}" "${PROXY_URL}")
# check arch
if [ $(uname -m) = "x86_64" ]; then
PLATFORM=amd64
fi
if [ $(uname -m) = "aarch64" ]; then
PLATFORM=arm64
fi
FILE_NAME=frp_${FRP_VERSION}_linux_${PLATFORM}
if [ ! -f "${WORK_PATH}/${FILE_NAME}.tar.gz" ]; then
if [ $GOOGLE_HTTP_CODE == "200" ]; then
wget -P ${WORK_PATH} https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${FILE_NAME}.tar.gz -O ${FILE_NAME}.tar.gz
wget -P ${WORK_PATH} https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.toml -O ${FRP_NAME}.toml
else
if [ $PROXY_HTTP_CODE == "200" ]; then
wget -P ${WORK_PATH} ${PROXY_URL}https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${FILE_NAME}.tar.gz -O ${FILE_NAME}.tar.gz
wget -P ${WORK_PATH} ${PROXY_URL}https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.toml -O ${FRP_NAME}.toml
else
echo -e "${Red}检测 GitHub Proxy 代理失效 开始使用官方地址下载${Font}"
wget -P ${WORK_PATH} https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${FILE_NAME}.tar.gz -O ${FILE_NAME}.tar.gz
wget -P ${WORK_PATH} https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.toml -O ${FRP_NAME}.toml
fi
fi
else
echo -e "${Green}文件 ${FILE_NAME}.tar.gz 已存在, 跳过下载.${Font}"
fi
tar -zxvf ${FILE_NAME}.tar.gz
mkdir -p ${FRP_PATH}
mv ${FILE_NAME}/${FRP_NAME} ${FRP_PATH}
mv ${FRP_NAME}.toml ${FRP_PATH}
# 配置 frps.service
cat >/lib/systemd/system/frps.service <<'EOF'
[Unit]
Description=Frp Server Service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
Restart=on-failure
RestartSec=5s
ExecStart=/usr/local/frp/frps -c /usr/local/frp/frps.toml
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
sudo systemctl start ${FRP_NAME}
sudo systemctl enable ${FRP_NAME}
# clean
rm -rf ${WORK_PATH}/${FILE_NAME}.tar.gz ${WORK_PATH}/${FILE_NAME} ${FRP_NAME}_linux_install.sh
echo -e "${Green}====================================================================${Font}"
echo -e "${Green}安装成功,请先修改 ${FRP_NAME}.toml 文件,确保格式及配置正确无误!${Font}"
echo -e "${Red}vi /usr/local/frp/${FRP_NAME}.toml${Font}"
echo -e "${Green}修改完毕后执行以下命令重启服务:${Font}"
echo -e "${Red}sudo systemctl restart ${FRP_NAME}${Font}"
echo -e "${Green}====================================================================${Font}"

View File

@@ -1,13 +1,33 @@
#!/bin/sh #!/usr/bin/env bash
# 停止frps PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
sudo systemctl stop frps && \ export PATH
# 删除frps
rm -rf /usr/local/frp && \ # fonts color
# 删除frps.service Green="\033[32m"
rm -rf /lib/systemd/system/frps.service && \ Red="\033[31m"
sudo systemctl daemon-reload && \ Yellow="\033[33m"
GreenBG="\033[42;37m"
RedBG="\033[41;37m"
Font="\033[0m"
# fonts color
# variable
WORK_PATH=$(dirname $(readlink -f $0))
FRP_NAME=frps
FRP_VERSION=0.67.0
FRP_PATH=/usr/local/frp
# 停止frpc
sudo systemctl stop ${FRP_NAME}
sudo systemctl disable ${FRP_NAME}
# 删除frpc
rm -rf ${FRP_PATH}
# 删除frpc.service
rm -rf /lib/systemd/system/${FRP_NAME}.service
sudo systemctl daemon-reload
# 删除本文件 # 删除本文件
rm -rf frps_linux_uninstall.sh rm -rf ${FRP_NAME}_linux_uninstall.sh
echo "============================" &&\
echo -e "\033[32m卸载成功,相关文件已清理完毕!\033[0m" && \ echo -e "${Green}============================${Font}"
echo "============================" echo -e "${Green}卸载成功,相关文件已清理完毕!${Font}"
echo -e "${Green}============================${Font}"