纯小白,不喜勿喷
下载客户端
1.创建一个clash文件夹,我放到opt目录,根据自己修改
mkdir /opt/clash && cd /opt/clash
2.拉取客户端 Github下载地址
wget http://gh.301.ee/https://github.com/Dreamacro/clash/releases/download/v1.10.6/clash-linux-amd64-v1.10.6.gz
3.解压一下文件
gunzip clash-linux-amd64-v1.10.6.gz
4.加执行权限
chmod +x clash-linux-amd64-v1.10.6
5.改一个方便的名字
mv clash-linux-amd64-v1.10.6 clash
初始化程序
./clash
- 这里会有如下报错,连接不上。没关系,挂代理自己下载拉进服务器
[email protected]:/opt/clash# ./clash
INFO[0000] Can't find config, create a initial config file
INFO[0000] Can't find MMDB, start download
FATA[0030] Initial configuration directory error: can't initial MMDB: can't download MMDB: Get "https://cdn.jsdelivr.net/gh/Dreamacro/[email protected]/Country.mmdb": dial tcp 199.59.148.89:443: i/o timeout
MMDB手动下载
将MMDB放到~/.config/clash/
目录里
配置文件
自己机场的clash配置文件拉过来放到/opt/clash
目录里改名成config.yaml

- 没有订阅文件的,配置文件参数有很多自己google下写一个吧,或者方便点用V2ray转clash配置文件
带上-f参数指定配置文件启动一下
./clash -f config.yaml
如下图就是clash启动成功了

PS:本来想写进/etc/systemd/system/clash.serviced的
但是一直提示下载MMDB失败,有大佬知道的可以提点一下。以下图片不用操作!


添加到快捷脚本并设置一键变量
#启动clash
pkill -f clash; sleep 10; nohup /opt/clash/clash -f config.yaml> /tmp/clash.pid &

如图显示nohup: ignoring input and redirecting stderr to stdout
就成功启动了clashCtrl+c
即可
增加一下变量,一键使用代理或者取消代理
vim ~/.bashrc
#插入如下代码
alias proxy="export http_proxy=http://127.0.0.1:7890;export https_porxy=http://127.0.0.1:7890"
alias unproxy="unset http_proxy;unset https_porxy;"

:wq
保存并退出
编译一下.bashrc
source ~/.bashrc
测试一下
curl -i google.com
ok,没反应,Ctrl+c
输入刚才设置过的变量proxy
proxy
curl -i google.com

如图输出的话,恭喜你!可以科学上网啦~~~
相反unproxy
就是取消代理,这里就不演示了
ui配置
公共dashboard
- 网页打开http://clash.razord.top/,选择设置,点击编辑外部控制设置旁边的蓝色ip:端口
其他的GUI管理网页也是可以的http://yacd.haishan.me/
填入配置文件中的管理ip端口密码,连上clash
ps:记得开放9090端口!!

之后可以继续在这里设置端口和其他管理
这里的结果并不会保存到配置文件,就是临时生效
在代理里选择使用的服务器
私有ui
1.创建ui文件夹并拉取文件
mkdir /opt/clash/ui && cd /opt/clash/ui
wget https://codeload.github.com/Dreamacro/clash-dashboard/zip/refs/heads/gh-pages
2.解压提取文件
unzip gh-pages
rm -rf gh-pages
mv clash-dashboard-gh-pages/* .
3.修改config.yaml指向ui
vim /opt/clash/config.yaml
#在external-controller: 0.0.0.0:9090下面加入
external-ui: /opt/clash/ui
:wq
保存并退出
4.重启clash
cd /opt/clash目录下执行以下命令
重新执行pkill -f clash; sleep 10; nohup /opt/clash/clash -f config.yaml> /tmp/clash.pid &
通过 IP+9090/ui 访问你的UI后台选择一个不挂的jiedian,这个就不讲了。

打卡升级
楼主辛苦了,感谢分享
nohup: 忽略输入重定向错误到标准输出端😭不知道怎么解决
方通过银行集团等一会
真棒,感谢分享!