Clash 需要在后台运行, 但是目前 Golang 还没有很好的守护进程实现, 因此我们推荐使用第三方工具来创建 Clash 的守护进程.
systemd
使用以下命令将 Clash 二进制文件复制到 /usr/local/bin, 配置文件复制到 /etc/clash:
cp clash /usr/local/bin
cp config.yaml /etc/clash/
cp Country.mmdb /etc/clash/
创建 systemd 配置文件 /etc/systemd/system/clash.service:

[Unit]
Description=Clash 守护进程, Go 语言实现的基于规则的代理.
After=network-online.target
[Service]
Type=simple
Restart=always
ExecStart=/usr/local/bin/clash -d /etc/clash
[Install]
WantedBy=multi-user.target
之后, 您应该使用以下命令重新加载 systemd:
systemctl daemon-reload
使用以下命令在系统启动时启动 Clash:
systemctl enable clash
使用以下命令立即启动 Clash:
systemctl start clash
使用以下命令检查 Clash 的运行状况和日志:
systemctl status clash
journalctl -xe