linux部署代理服务

这次演示使用clash+dashboard作为代理服务并配合机场使用

安装

先在用户目录下安装一个clash文件夹,并进入到其中
1
mkdir clash && cd clash

然后再目录下,把机场给的config.yaml下载下来,可以使用wget
1
wget "机场给你的订阅链接" -O config.yaml

然后从github上获取clash和dashboard的二进制文件。
1
2
wget https://github.com/Dreamacro/clash/releases/download/v1.11.12/clash-linux-amd64-v1.11.12.gz
wget https://github.com/haishanh/yacd/releases/download/v0.3.7/yacd.tar.xz

如果你的服务器的网络不好,可以通过这个链接下载内容(这里已经完成了解压步骤)。然后上传到服务器即可
你可以从以下链接获取clash和dashboard的与你服务器适配的版本。
clash
dashboard

然后解压两个文件
1
2
gzip -d clash-linux-amd64-v1.11.12.gz
tar -xvf yacd.tar.xz && mv public dashboard

给clash添加执行权限
1
chmod +x clash

编辑config.yaml配置
1
2
3
4
5
6
7
8
9
port: 7890
socks-port: 7891
allow-lan: true
mode: Rule
log-level: info
secert: 123456 // 增加这一行, 如果你希望你的clash
web要密码访问可以在这块配置密码, 如果不需要直接注释掉即可
external-ui: dashboard // 增加这一行
external-controller: 0.0.0.0:9090

然后执行./clash -d .
即可运行起来。

然后配置代理服务。

  • 如果只是暂时使用
    1
    2
    3
    export https_proxy=http://127.0.0.1:7890           
    export http_proxy=http://127.0.0.1:7890
    export all_proxy=socks5://127.0.0.1:7891
  • 也可以配置到~./bashrc中
    然后source ./bashrc
    需要关闭代理可以
    1
    2
    3
    unset http_proxy
    unset https_proxy
    unset all_proxy
    参考以下博客内容

    https://parrotsec-cn.org/t/linux-clash-dashboard/5169