下载文件

Github:

https://github.com/Dreamacro/clash/releases/tag/v1.18.0

库没了,找镜像吧

解压

1
gzip -d cnn o-linux-amd64-v1.18.0.gz

加权限

1
chmod 764 ./clash-linux-amd64-v1.18.0

运行

1
./clash-linux-amd64-v1.18.0 

这时会自动下载Country.mmdb

配置代理

首次运行后会有 ~/.config/clash,进入这个文件夹,里面是自动创建的配置文件,修改config.yaml即可
或者wget -O config.yaml 订阅地址

修改代理规则/代理模式

安装ui面板

不安了,直接用 yacd-dashboard:http://yacd.haishan.me/

确保开启了外部控制选项

config.yaml

1
2
3
4
5
external-controller: :9090

## 如果本地安装了ui面板那得写出面板路径
## ui 表示在 ~/.config/clash 下 ui 文件夹内是面板的文件(有yacd.ico等文件)
# external-ui: ui

然后访问ip:9090(放行端口), 应该看到

1
2
3
{
"hello": "clash"
}

然后在yacd中填写地址http://ip:9090,连接,进入修改

代理命令行

~/.profile或者~/.bash_profile或者~/.zprofile(取决于用什么shell)中添加了函数proxy,之后可以通过proxy_onproxy_off来开启和关闭代理。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function proxy_on() {
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
echo -e "终端代理已开启。"
}

function proxy_off(){
unset http_proxy https_proxy
echo -e "终端代理已关闭。"
}
~/hexo > proxy_on
终端代理已开启。

~/hexo > npx hexo init blog
INFO Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
INFO Install dependencies
INFO Start blogging with Hexo!

~/hexo > proxy_off
终端代理已关闭。