安装使用frp客户端

下载对应客户端包

1
curl -LO https://github.com/fatedier/frp/releases/download/v0.42.0/frp_0.42.0_linux_amd64.tar.gz

解压压缩包

tar -zxvf frp_0.38.0_linux_amd64.tar.gz

安装

sudo cp frp_0.38.0_linux_amd64/frpc /usr/bin/
sudo mkdir /etc/frp
sudo cp frp_0.38.0_linux_amd64/frpc.ini /etc/frp/
sudo cp frp_0.38.0_linux_amd64/systemd/frpc.service /etc/systemd/system/

编辑简单配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[common]
server_addr = my.domain
server_port = 7000
admin_addr = 127.0.0.1
admin_port = 9000
admin_user = admin
admin_pwd = admin111111

# tcp_name 可以自由设置
[tcp_name_1]
type=tcp
local_port = 9000
remote_port = 9000

[tcp_name_2]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 822

# http_name 可以自由设置
[http_name]
type = http
local_port = 80
use_encryption = false
use_compression = true
subdomain = subdomain

开启和开机启动

sudo systemctl start frpc
sudo systemctl enable frpc

service

frpc.service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[Unit]
Description=Frp Client Service
After=network.target

[Service]
Type=simple
User=nobody
Restart=on-failure
RestartSec=5s
ExecStart=/usr/bin/frpc -c /etc/frp/frpc.ini
ExecReload=/usr/bin/frpc reload -c /etc/frp/frpc.ini
LimitNOFILE=1048576

[Install]
WantedBy=multi-user.target

frps.service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[Unit]
Description=Frp Server Service
After=network.target

[Service]
Type=simple
User=nobody
Restart=on-failure
RestartSec=5s
ExecStart=/usr/bin/frps -c /etc/frp/frps.ini
LimitNOFILE=1048576

[Install]
WantedBy=multi-user.target

参考