Run as a service
Using systemd
Section titled “Using systemd”-
Download the binary executable file from releases.
-
Rename the downloaded binary executable file to
mihomoand move it to/usr/local/bin/. -
Run Mihomo as a daemon.
Use the following commands to copy the Mihomo binary file to /usr/local/bin and the configuration file to /etc/mihomo:
cp mihomo /usr/local/bincp config.yaml /etc/mihomoCreate a systemd configuration file /etc/systemd/system/mihomo.service:
[Unit]Description=mihomo Daemon, Another Clash Kernel.After=network.target NetworkManager.service systemd-networkd.service iwd.service
[Service]Type=simpleLimitNPROC=500LimitNOFILE=1000000CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW CAP_NET_BIND_SERVICE CAP_SYS_TIME CAP_SYS_PTRACE CAP_DAC_READ_SEARCH CAP_DAC_OVERRIDEAmbientCapabilities=CAP_NET_ADMIN CAP_NET_RAW CAP_NET_BIND_SERVICE CAP_SYS_TIME CAP_SYS_PTRACE CAP_DAC_READ_SEARCH CAP_DAC_OVERRIDERestart=alwaysExecStartPre=/usr/bin/sleep 1sExecStart=/usr/local/bin/mihomo -d /etc/mihomoExecReload=/bin/kill -HUP $MAINPID
[Install]WantedBy=multi-user.targetReload systemd using the following command:
systemctl daemon-reloadEnable the Mihomo service:
systemctl enable mihomoStart Mihomo immediately with the following command:
systemctl start mihomoReload Mihomo with the following command:
systemctl reload mihomoCheck the status of Mihomo with the following command:
systemctl status mihomoCheck the running logs of Mihomo with the following command:
journalctl -u mihomo -o cat -eOr
journalctl -u mihomo -o cat -f