非常重要!!!

永久地址 cgy.pw一定收藏永久地址,防止失联.

👉点我访问 cgy.pw 然后 Ctrl + D 收藏
帮助文档

Linux教程 命令行运行

管理员

clash (meta)

下载安装包

linux x64下载

curl https://d2.duckgogo.net/mihomo/mihomo-linux-amd64-v1.18.6.gz -o mihomo.gz

or

curl https://d2.duckgogo.net/mihomo/mihomo-linux-amd64-compatible-v1.18.6.gz -o mihomo.gz

linux arm64下载

curl https://d2.duckgogo.net/mihomo/mihomo-linux-arm64-v1.18.6.gz -o mihomo.gz

解压缩

gzip -d mihomo.gz

增加运行权限

chmod +x mihomo

下载clash配置文件

中文引号“替换为英文引号

curl “&flag=meta” -o config.yaml

运行

./mihomo -f config.yaml

以服务方式运行 - systemd

使用以下命令将 Clash 二进制文件复制到 /usr/local/bin/ 文件夹, 配置文件复制到 /etc/mihomo/ 文件夹:

sudo cp mihomo /usr/local/bin/
sudo mkdir /etc/mihomo/
sudo cp config.yaml /etc/mihomo/

创建 systemd 配置文件 /etc/systemd/system/mihomo.service:

[Unit]
Description=mihomo Daemon, Another Clash Kernel.
After=network.target NetworkManager.service systemd-networkd.service iwd.service

[Service]
Type=simple
LimitNPROC=500
LimitNOFILE=1000000
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW CAP_NET_BIND_SERVICE CAP_SYS_TIME CAP_SYS_PTRACE CAP_DAC_READ_SEARCH CAP_DAC_OVERRIDE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_RAW CAP_NET_BIND_SERVICE CAP_SYS_TIME CAP_SYS_PTRACE CAP_DAC_READ_SEARCH CAP_DAC_OVERRIDE
Restart=always
ExecStartPre=/usr/bin/sleep 1s
ExecStart=/usr/local/bin/mihomo -d /etc/mihomo
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

启动

systemctl daemon-reload
systemctl enable mihomo
systemctl start mihomo

查看日式

journalctl -u mihomo -o cat -f

启动成功的日志,可通过http://局域网ip:7890或者socks5://局域网ip:7890进行连接

time="2024-06-08T06:48:03.696007163Z" level=info msg="Initial configuration complete, total time: 8319ms"
time="2024-06-08T06:48:03.696814157Z" level=info msg="RESTful API listening at: [::]:9093"
time="2024-06-08T06:48:03.70328271Z" level=info msg="Sniffer is closed"
time="2024-06-08T06:48:03.703315451Z" level=info msg="Use tcp concurrent"
time="2024-06-08T06:48:03.703358798Z" level=info msg="NTP service start, sync system time is false"
time="2024-06-08T06:48:03.796040559Z" level=info msg="System clock is behind NTP time by 1.756498ms"
time="2024-06-08T06:48:03.796466775Z" level=info msg="Mixed(http+socks) proxy listening at: [::]:7890"
time="2024-06-08T06:48:03.80036619Z" level=info msg="Start initial Compatible provider Fallback-备用线路"
time="2024-06-08T06:48:03.800470254Z" level=info msg="Start initial Compatible provider Auto-自动择优"
time="2024-06-08T06:48:03.800589918Z" level=info msg="Start initial Compatible provider 在此组切换线路-SwitchNode"
time="2024-06-08T06:48:03.800944496Z" level=info msg="Start initial Compatible provider default"

sing-box

安装

Debian/Ubuntu

bash <(curl -fsSL https://sing-box.app/deb-install.sh)

Arch Linux

bash <(curl -fsSL https://sing-box.app/arch-install.sh)

拉取配置文件

中文引号“替换为英文引号

curl “&flag=sing-box” -o config.json

启动

sing-box run -c config.json

以服务方式启动 - systemd

todo

参考链接

← 返回文档页面