以前写过一个realm的安装小脚本,随着软件升级,似乎不能用了,所以更新一下。
这里简单记录一下,以备查找。
流量转发工具,详情见官方说明。
官方地址
可以参照官方说明自己配置。
不多废话,记录一下脚本内容。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/bin/bash
# choose a file according to your need.
REALM_DL="https://github.com/zhboner/realm/releases/download/v2.4.5/realm-aarch64-unknown-linux-musl.tar.gz"
CONF_DIR="/usr/local/etc/realm"
BIN_DIR="/usr/local/bin"
# create directory
mkdir -p ${CONF_DIR} && touch ${CONF_DIR}/config.toml
mkdir -p ${BIN_DIR}
# download
wget ${REALM_DL} -O realm.tar.gz && tar xzf realm.tar.gz
chmod +x realm && mv realm ${BIN_DIR}
# systemd
cat <<EOF > /lib/systemd/system/realm.service
[Unit]
Description=realm
After=network.target
[Service]
Type=simple
User=nobody
Restart=on-failure
RestartSec=5s
ExecStart=${BIN_DIR}/realm -c ${CONF_DIR}/config.toml
[Install]
WantedBy=multi-user.target
EOF
# configuration, add your own address and ports.
cat <<EOF > ${CONF_DIR}/config.toml
[log]
level = "warn"
output = "/var/log/realm.log"
[network]
no_tcp = false
use_udp = true
[[endpoints]]
listen = "0.0.0.0:6666"
remote = "1.1.1.1:7777"
[[endpoints]]
listen = "0.0.0.0:3333"
remote = "www.google.com:443"
EOF
touch /var/log/realm.log
chown nobody:nogroup /var/log/realm.log
chown nobody:nogroup ${BIN_DIR}/realm
chown nobody:nogroup -R ${CONF_DIR}
rm realm.tar.gz
# restart
systemd daemon-reload && systemd enable realm
systemctl restart realm && systemctl status realm
|
根据需要修改,然后执行就好。
OVER