1 什么是Clash?

78805a221a988e7-44

Clash 是一个跨平台的基于规则的代理实用程序,运行在网络和应用层,支持开箱即用的各种代理和反审查协议。

Clash 的使用对普通用户来说可能具有挑战性。那些可能想考虑改用 GUI 客户端,我们确实有一些建议:

2 安装Linux Clash

2.1 下载Clash

image-20230906191333077

2.2 上传至Linux服务器

  • 创建文件夹
1
mkdir /opt/clash && cd /opt/clash
  • 上传或移动
1
mv clash-linux-386-v1.16.0 /opt/clash/clash

2.3 解压Clash

1
gunzip clash-linux-386-v1.16.0.gz

2.4 文件夹授权

1
chmod +x clash

3 设置Clash的配置

注:clash默认读取的配置文件位置在:~/.config/clash/

3.1 设置配置文件

  • 创建一个文件夹:放置我们的Clash配置文件
1
mkdir ~/.config/clash/ && cd ~/.config/clash/ 
  • 获取配置文件

如果没法直接下载,从PC电脑获取到Windows本地Clash的yamlmmdb文件放到服务器的./config/clash/下面亦可,yaml文件命名为config.yamlmmdb文件命名为:Country.mmdb

1
2
sudo wget -O config.yaml "yaml下载链接"
sudo wget -O XXX.mmdb "mmdb下载链接"

yaml 文件大致内容如:

1
2
3
4
5
6
7
8
9
mixed-port: 7890
allow-lan: true
bind-address: '*'
mode: rule
log-level: info
external-controller: '127.0.0.1:9090'
dns:
enable: true
......

4 启动服务

  • 直接启动我们的./clash即可
1
2
3
4
5
6
[root@VM-4-12-centos clash]# ./clash 
INFO[0000] Start initial compatible provider 自动选择
INFO[0000] Start initial compatible provider FreeGecko
INFO[0000] Start initial compatible provider 故障转移
INFO[0000] RESTful API listening at: 127.0.0.1:34567
INFO[0000] Mixed(http+socks) proxy listening at: [::]:7890