Using systemd
On Linux systems, using systemd
can conveniently control the start, stop, background running configuration, and boot auto-start of the frps server.
Here are the specific operation steps:
-
Install systemd
If systemd is not yet installed on your Linux server, you can use package managers like
yum
(for CentOS/RHEL) orapt
(for Debian/Ubuntu) to install it:# Install systemd using yum (CentOS/RHEL) yum install systemd # Install systemd using apt (Debian/Ubuntu) apt install systemd
-
Create frps.service file
Use a text editor (like vim) to create a
frps.service
file in the/etc/systemd/system
directory to configure the frps service.$ sudo vim /etc/systemd/system/frps.service
Write the content:
[Unit] # Service name, customizable Description = frp server After = network.target syslog.target Wants = network.target [Service] Type = simple # Command to start frps, modify to your frps installation path ExecStart = /path/to/frps -c /path/to/frps.toml [Install] WantedBy = multi-user.target
-
Use systemd commands to manage frps service
# Start frp sudo systemctl start frps # Stop frp sudo systemctl stop frps # Restart frp sudo systemctl restart frps # Check frp status sudo systemctl status frps
-
Set frps to auto-start on boot
sudo systemctl enable frps
By following the above steps, you can easily use systemd to manage the frps service, achieving start, stop, automatic running, and boot auto-start. Make sure to replace paths and configuration file names to match your actual installation.