中文 English

Ubuntu installs Frp server, non-client

Published: 2021-01-23
Ubuntu frpc frps bash github nohup server

Download and extract FRP

cd ~
mkdir frp
cd frp
wget https://github.com/fatedier/frp/releases/download/v0.35.0/frp_0.35.0_linux_amd64.tar.gz
tar -xvzf frp_0.35.0_linux_amd64.tar.gz
cd frp_0.35.0_linux_amd64

Configure FRP

cd ~/frp/frp_0.35.0_linux_amd64/
rm frpc
rm frpc.ini
rm frpc_full.ini
ls -a
sudo su
rm frps.ini
cat>/etc/frps.ini<<EOF

[common]
# FRP server bind port
bind_port = 1000
# Set the HTTP access port to 1001
vhost_http_port = 1001
# Set the domain name (make sure it is reachable)
subdomain_host = frp.margrop.net

# Configure the dashboard (optional)
dashboard_port = 3456
# Dashboard username and password, both default to `admin`
dashboard_user = admin
dashboard_pwd = admin

EOF

Start the FRP server

Set the FRP server to start automatically

Reference:

cd ~/frp/frp_0.35.0_linux_amd64/
nohup ./frps -c /etc/frps.ini &

Set FRP server auto-start

ln -fs /lib/systemd/system/rc-local.service /etc/systemd/system/rc-local.service
cd /etc/systemd/system/
cat rc-local.service

echo >> rc-local.service
echo [Install] >> rc-local.service
echo WantedBy=multi-user.target >> rc-local.service
echo Alias=rc-local.service >> rc-local.service
echo '#!/bin/bash' >> /etc/rc.local
echo 'cd ~/frp/frp_0.35.0_linux_amd64/' >> /etc/rc.local
echo "nohup ./frps -c /etc/frps.ini &" >> /etc/rc.local
chmod 755 /etc/rc.local
cat /etc/rc.local

Reference https://blog.csdn.net/u013144287/article/details/78589643