记录下在 Cent OS 中安装使用 clash 的过程。
¶1、创建目录
1 | cd /mnt && mkdir clash |
¶2、下载 clash 并解压
1 | wget https://github.com/Dreamacro/clash/releases/download/v1.11.12/clash-linux-amd64-v1.11.12.gz |
最新版本可在 https://github.com/Dreamacro/clash 查看,执行以下命令解压并将二进制文件重命名为 clash。
1 | gzip -d clash-linux-amd64-v1.11.12.gz |
¶3、下载配置文件
在 clash 二进制文件的目录下执行以下命令下载你的 clash 配置文件。
1 | wget -o config.yaml "配置文件的 url" |
¶4、启动 clash
1 | ./clash -d . |
上述命令会启动 Clash,同时启动 HTTP 代理和 Socks5 代理;在上述命令后加上&
,可以后台运行。如果提示权限不足,请执行chmod +x clash
。
注意
当出现如下报错时,请执行以下命令下载文件并重命名为Country.mmdb
,参考:clash issue 854
INFO[0000] Can’t find MMDB, start download
1 | wget "https://raw.githubusercontent.com/wp-statistics/GeoLite2-Country/master/GeoLite2-Country.mmdb.gz" |
¶5、下载静态页面 可选
1 | wget https://github.com/haishanh/yacd/archive/gh-pages.zip |
下载后自行 build,使用 dist 文件夹
1 | port: 7890 |
访问server ip:7891/ui
:
¶6、启用/停用代理
1 | export http_proxy=127.0.0.1:7890 |
可以通过cat $http_proxy
来查看是否启用了临时代理
1 | unset http_proxy |