clash for linux

Clash 是一个使用 Go 语言编写,基于规则的跨平台代理软件核心程序。

下载

1
wget https://github.com/Dreamacro/clash/releases/download/v1.13.0/clash-linux-amd64-v1.13.0.gz

最新版本 https://github.com/Dreamacro/clash/releases

安装

解压后直接执行,将在 ~/.config/ 目录下生成一个 clash 目录,其中有配置文件

1
2
3
4
5
gzip -d clash-linux-amd64-v1.13.0.gz
chmod +x clash-linux-amd64-v1.13.0
./clash-linux-amd64-v1.13.0
INFO[0000] Can't find config, create a initial config file
INFO[0000] Can't find MMDB, start download

为了后期管理方便,可以之间将解压后的 clash 拷贝到 ~/.config/clash 目录下,并重命名为 clash

1
2
3
4
cp ./clash-linux-amd64-v1.13.0 ~/.config/clash/clash

$ls ~/.config/clash/
clash config.yaml

配置

下载配置文件

1
2
wget -O config.yaml "代理商提供的订阅链接"
wget -O config.yaml "https://xxxxxxxxxxxxxxxxxx06d2739906177ad22&flag=clash"

如果下载到的是一大堆字符则需要在订阅链接的后面添加 &flag=clash

执行./clash,将会下载 Country.mmdb

1
2
./clash
WARN[0000] MMDB invalid, remove and download

如果下载失败进行手动下载

1
2
3
$./clash
WARN[0000] MMDB invalid, remove and download
FATA[0030] Initial configuration directory error: can't initial MMDB: can't download MMDB: Get "https://cdn.jsdelivr.net/gh/Dreamacro/maxmind-geoip@release/Country.mmdb": dial tcp 146.75.113.229:443: i/o timeout
1
wget -O Country.mmdb https://www.sub-speeder.com/client-download/Country.mmdb

https://github.com/Dreamacro/maxmind-geoip/releases 下载也可以

以上准备配置文件弄号后就可以运行

1
2
3
4
5
6
7
8
9
10
~/.config/clash
↪ =>$ls
clash config.yaml Country.mmdb

↪ =>$./clash
INFO[0000] Start initial compatible provider 故障转移
INFO[0000] Start initial compatible provider 自动选择
INFO[0000] Start initial compatible provider 一元机场
INFO[0000] RESTful API listening at: 127.0.0.1:9090
INFO[0000] Mixed(http+socks) proxy listening at: [::]:7890

clash 启动后用浏览器访问网址 http://clash.razord.top/ ,在这里修改配置信息

命令行设置:

1
2
3
4
5
6
7
8
9
10
gsettings set org.gnome.system.proxy.http host '127.0.0.1'
gsettings set org.gnome.system.proxy.http port 7890
gsettings set org.gnome.system.proxy.https host '127.0.0.1'
gsettings set org.gnome.system.proxy.https port 7890
gsettings set org.gnome.system.proxy.ftp host ''
gsettings set org.gnome.system.proxy.ftp port 0
gsettings set org.gnome.system.proxy.socks host '127.0.0.1'
gsettings set org.gnome.system.proxy.socks port 7890

gsettings set org.gnome.system.proxy mode 'manual';

git 代理

https 传输

  • http 代理

    1
    2
    git config --global http.proxy 'http://127.0.0.1:1080'
    git config --global https.proxy 'http://127.0.0.1:1080'
  • socks5 代理

    1
    2
    git config --global http.proxy 'socks5://127.0.0.1:1081'  
    git config --global https.proxy 'socks5://127.0.0.1:1081'
  • 取消代理

    1
    2
    git config --global --unset http.proxy  
    git config --global --unset https.proxy

参考

  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
  • Copyrights © 2023 SunnyYang
  • Visitors: | Views:

请我喝杯咖啡吧~

支付宝
微信