Set the frps/frpc as the automatic service managed by systemd

frps.service

Copy the folder containing the installation package and configuration files to /usr/local/bin, and configure systemd accordingly.

1
2
3
[root@frp-server ~]# mv frp_0.62.0_linux_amd64 /usr/local/bin/frp
[root@frp-server ~]# ls /usr/local/bin/frp
frpc frpc.toml frps frps.toml LICENSE

Supplementation of monitoring Frp server

1
2
3
4
5
6
7
8
9
# Edit the frps.toml configuration file, add the following lines
vim frps.toml

bindPort = 7000
auth.token = "sunhaoyang"
webServer.addr = "0.0.0.0"
webServer.port = 7500
webServer.user = "admin"
webServer.password = "admin_password"

Here’s a breakdown of the server parameters:

  • bindPort = 7000: This is the port the server listens on (7000), and the client connects to the server through this port.

  • auth.token = “sunhaoyang”: This sets an authentication token. The client and server use this token to authenticate each other—like a key,only matching tokens can establish a connection.

  • webServer.addr = “0.0.0.0”: The web server listens on all network interfaces, making it accessible from anywhere.

  • webServer.port = 7500: This is the port for the web server (7500), which is used to access the FRP management interface.

  • webServer.user = “admin” and webServer.password = “admin_password”: These are the username and password for the web server, required for logging into the management interface.

Create the systemd service unit

1
2
3
4
5
6
7
8
9
10
11
12
13
14
cat > /etc/systemd/system/frps.service <<-'EOF'
[Unit]
Description=FRP Server Service
After=network.target

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/frp/frps -c /usr/local/bin/frp/frps.toml
Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF

Start the service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@frp-server ~]# systemctl daemon-reload
[root@frp-server ~]# systemctl enable frps.service --now
Created symlink /etc/systemd/system/multi-user.target.wants/frps.service → /etc/systemd/system/frps.service.
[root@frp-server ~]# systemctl status frps.service
● frps.service - FRP Server Service
Loaded: loaded (/etc/systemd/system/frps.service; enabled; preset: disabled)
Active: active (running) since Fri 2025-04-25 16:06:45 CST; 4s ago
Main PID: 355286 (frps)
Tasks: 5 (limit: 12344)
Memory: 9.0M
CPU: 324ms
CGroup: /system.slice/frps.service
└─355286 /usr/local/bin/frp/frps -c /usr/local/bin/frp/frps.toml

Apr 25 16:06:45 frp-server systemd[1]: Started FRP Server Service.
Apr 25 16:06:45 frp-server frps[355286]: 2025-04-25 16:06:45.952 [I] [frps/root.go:105] frps uses config file: /usr/local/bin/frp/frps.toml
Apr 25 16:06:46 frp-server frps[355286]: 2025-04-25 16:06:46.270 [I] [server/service.go:237] frps tcp listen on 0.0.0.0:7000
Apr 25 16:06:46 frp-server frps[355286]: 2025-04-25 16:06:46.271 [I] [frps/root.go:114] frps started successfully
Apr 25 16:06:46 frp-server frps[355286]: 2025-04-25 16:06:46.271 [I] [server/service.go:351] dashboard listen on 0.0.0.0:7500

Now, Try logging into the web interface on port 7500 by entering http://<public IP> in your browser!

From the chart, you can see the traffic and connection information. By clicking on the left, you can view details about different types of proxy.

frps webui

frpc.service

For frpc.service, please just follow the operations above, similarl to the frps.service. Have a try!

Copy the folder containing the installation package and configuration files to /usr/local/bin, and configure systemd accordingly.

1
2
3
4
5
[root@internal-sshserver ~]# mv frp_0.62.0_linux_amd64 /usr/local/bin/frp
[root@internal-sshserver ~]# ls /usr/local/bin/frp
frpc frpc.toml frps frps.toml LICENSE
[root@internal-sshserver ~]# cd /usr/local/bin/frp
[root@internal-sshserver frp]# vim frpc.toml

Supplementation of monitoring Frp server

1
2
3
4
5
6
7
8
9
10
serverAddr = "x.x.x.x"      # Frps's public ip address
serverPort = 7000 # Frps's listening port
auth.token = "lixiaohui" # Same as the server's auth.token above
[[proxies]]
name = "ssh" # Proxy name
type = "tcp" # Proxy type (TCP)
localIP = "127.0.0.1" # Frpc's service ip address
localPort = 22 # Frpc's listening port(e.g. SSH service)
remotePort = 6000 # Expose port on the Frps's server for external calling

Create the systemd service unit

1
2
3
4
5
6
7
8
9
10
11
12
13
14
cat > /etc/systemd/system/frpc.service <<-'EOF'
[Unit]
Description=FRP Client Service
After=network.target

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/frp/frpc -c /usr/local/bin/frp/frpc.toml
Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF

Start the service

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@internal-sshserver ~]# systemctl daemon-reload
[root@internal-sshserver ~]# systemctl enable frpc.service --now
[root@internal-sshserver ~]# systemctl status frpc.service
● frpc.service - FRP Client Service
Loaded: loaded (/etc/systemd/system/frps.service; enabled; preset: disabled)
Active: active (running) since Fri 2025-04-25 16:29:13 CST; 14s ago
Main PID: 94421 (frpc)
Tasks: 4 (limit: 12140)
Memory: 4.6M
CPU: 7ms
CGroup: /system.slice/frpc.service
└─94421 /usr/local/bin/frp/frpc -c /usr/local/bin/frp/frpc.toml

Apr 25 16:29:13 internal-sshserver systemd[1]: Started FRP Client Service.
Apr 25 16:29:13 internal-sshserver frpc[94421]: 2025-04-25 16:29:13.467 [I] [sub/root.go:149] start frpc service for config file [/usr/local/bin/frp/frpc.toml]
Apr 25 16:29:13 internal-sshserver frpc[94421]: 2025-04-25 16:29:13.467 [I] [client/service.go:314] try to connect to server...
Apr 25 16:29:13 internal-sshserver frpc[94421]: 2025-04-25 16:29:13.472 [I] [client/service.go:306] [66f9a7e320b717cd] login to server success, get run id [66f9a7e320b717cd]
Apr 25 16:29:13 internal-sshserver frpc[94421]: 2025-04-25 16:29:13.472 [I] [proxy/proxy_manager.go:177] [66f9a7e320b717cd] proxy added: [ssh]
Apr 25 16:29:13 internal-sshserver frpc[94421]: 2025-04-25 16:29:13.473 [I] [client/control.go:172] [66f9a7e320b717cd] [ssh] start proxy success
  1. The bindPort=serverPort must be allowed in the settings of firewall. (E.g. ufw allow xxx/ firewall-cmd –permanent –add-port=xxx)
  2. Some vendor/providers may filter the ports and the hardware firewall may block the nonstandard port.
  3. systemctl enable frps.service/frpc.service may be failed.
    Please sudo setenforce 0 change the selinux mode from enforce to permissive, and then systemctl restart frps.service/frpc.service again.
  4. Selinux context should be set as bin_t
    1
    2
    sudo semanage fcontext -a -t bin_t "/usr/local/bin/frp/frpc"
    sudo restorecon -v /usr/local/bin/frp/frpc
  5. Increase the interval between two failed restart processes and avoid to stop trying becasue of the frequent reboots.
    1
    2
    [Service]
    RestartSec=5s