- 在 https://github.com/doreamon-design/clash/releases
下载与自己系统相符的安装包,一般选择
clash_2.0.24_linux_amd64.tar.gz
- 将压缩包传至远程服务器后,执行以下命令:
1 2 3
| tar -xvf clash_2.0.24_linux_amd64.tar mv clash_2.0.24_linux_amd64 /usr/local/bin/clash clash -v
|
若能显示clash的版本,则说明已成功安装
1
| export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7891
|
完成上述步骤后,理论上便已成功配置,若出现如下的连接失败的问题:
1 2
| INFO[0000] Can't find MMDB, start download FATA[0000] Initial configuration directory error: can't initial MMDB: can't download MMDB: Get "https://cdn.jsdelivr.net/gh/Dreamacro/maxmind-geoip@release/Country.mmdb": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused
|
则可能是端口占用的问题,查看如下:
取消端口占用,再次查看:
1 2
| unset http_proxy https_proxy export | grep -i proxy
|
重新设置,之后即可正常连接:
1 2
| declare -x http_proxy="http://127.0.0.1:7890" declare -x https_proxy="http://127.0.0.1:7890"
|
为避免网络连接不稳定,也可以在代码中加入如下设置:
1 2 3
| import os os.environ['HTTP_PROXY'] = 'http://127.0.0.1:7890' os.environ['HTTPS_PROXY'] = 'http://127.0.0.1:7890'
|