Skip to content

Instantly share code, notes, and snippets.

@hubenchang0515
Last active November 6, 2024 12:43
Show Gist options
  • Save hubenchang0515/f90c8afbb61c84200568e1996fd5a630 to your computer and use it in GitHub Desktop.
Save hubenchang0515/f90c8afbb61c84200568e1996fd5a630 to your computer and use it in GitHub Desktop.
Ubuntu 配置 clash 代理

下载 clash

https://github.com/Dreamacro/clash/releases

下载配置

mkdir -p /root/.config/clash/
wget xxxxxx(订阅链接) -O /root/.config/clash/config.yaml

创建服务

编写 /etc/systemd/system/clash.service

[Unit]
Description=clash service
After=network.target

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/clash
Restart=on-failure # or always, on-abort, etc

[Install]
WantedBy=multi-user.target

设置自启动

sudo systemctl enable clash.service

设置系统代理

  • Settings -> Network -> Network Proxy 中选择 manual
  • 将 HTTP、HTTPS、FTP Proxy 设为 127.0.0.1:7890
  • 将 Socks Proxy 设为 127.0.0.1:7891

端口号可以在 config.yaml 中配置。

@Yxj-study
Copy link

请问怎么在虚拟环境中配置啊,我的clash能用但是ping google.com没有反应,项目中要用chatgpt但是不知道怎么在虚拟环境中配置

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment