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

以上是一段一段手搓,下面是一次完成的!

cd /tmp; \
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; \
cat > /root/config.toml <<EOF
[[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"
EOF
cat /etc/systemd/system/realm.service <<EOF
[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
EOF
systemctl daemon-reload; \
systemctl enable realm; \
systemctl restart realm; \
systemctl status realm

脚本系列

wget -N --no-check-certificate https://git.io/realm.sh && chmod +x realm.sh && ./realm.sh

最后修改:2024 年 03 月 08 日
如果觉得我的文章对你有用,请随意赞赏