Skip to content

Instantly share code, notes, and snippets.

@mayocream
Last active March 11, 2024 08:01
Show Gist options
  • Save mayocream/8d7a01440f59e4d85771f74e23ad4744 to your computer and use it in GitHub Desktop.
Save mayocream/8d7a01440f59e4d85771f74e23ad4744 to your computer and use it in GitHub Desktop.
/etc/systemd/system/clash.service
[Unit]
Description=Clash
After=network.target
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
WorkingDirectory=/etc/clash
User=root
ExecStart=/usr/local/bin/clash -d .
Restart=on-failure
LimitNOFILE=65536
RestartSec=5s
[Install]
WantedBy=multi-user.target
wget https://hub.fastgit.org/Dreamacro/clash/releases/download/v1.8.0/clash-linux-amd64-v1.8.0.gz
gzip -d clash-linux-amd64-v1.8.0.gz
mv clash-linux-amd64-v1.8.0 clash
sudo mv clash /usr/local/bin/
chmod +x /usr/local/bin/clash
# create clash systemd service
mkdir /etc/clash
cd /etc/clash
wget https://hub.fastgit.org/Dreamacro/maxmind-geoip/releases/latest/download/Country.mmdb
# download clash config, rename it: config.yaml
sudo systemctl daemon-reload
sudo systemctl enable clash
sudo systemctl start clash
sudo systemctl status clash
# add these to .zshrc
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
export all_proxy=http://127.0.0.1:7890
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment