1️⃣ 下载运行文件(自行去下面代码网址替换适合自己机器架构的版本):

wget -O realm.tar.gz https://github.com/zhboner/realm/releases/download/v2.4.6/realm-x86_64-unknown-linux-gnu.tar.gz && tar -xvf realm.tar.gz && chmod +x realm

Github被屏蔽的试试下面这个:

wget -O realm.tar.gz https://mirror.ghproxy.com/https://github.com/zhboner/realm/releases/download/v2.4.6/realm-x86_64-unknown-linux-gnu.tar.gz && tar -xvf realm.tar.gz && chmod +x realm

2️⃣ 去/root文件夹下新建config.toml文件,并写入(具体远程IP和端口,本机端口自己改):

[[endpoints]]

listen = "0.0.0.0:5000"

remote = "8.8.8.8:443"

[[endpoints]]

listen = "0.0.0.0:6000"

remote = "[2400:3200::1]:443"

3️⃣ 去/etc/systemd/system文件夹下新建realm.service文件,并写入:

[Unit]

Description=realm

After=network-online.target

Wants=network-online.target systemd-networkd-wait-online.service

[Service]

Type=simple

User=root

Restart=on-failure

RestartSec=5s

DynamicUser=true

WorkingDirectory=/root

ExecStart=/root/realm -c /root/config.toml

[Install]

WantedBy=multi-user.target

4️⃣ 启动服务:

systemctl daemon-reload

systemctl enable realm

systemctl restart realm

systemctl status realm