Linux安装clash

  1. 作者QQ:67065435 QQ群:669756510

  2. 本站内容全部为作者原创,转载请注明出处!

安装clash

  1. 创建项目文件
    mkdir /usr/local/clash
    cd /usr/local/clash
    # 关于<订阅链接>推荐:【https://xn--4gq62f52gdss.com/#/register?code=Yc5UzCyE】
    # 以上<订阅链接>一年11元,相比免费版更稳定,很划算了。
    wget --no-check-certificate -c <订阅链接> -O config.yaml
    wget --no-check-certificate -c https://dl.ssrss.club/Country.mmdb
    wget --no-check-certificate -c https://github.com/Dreamacro/clash/releases/download/v1.15.1/clash-linux-amd64-v1.15.1.gz
    gunzip -c clash-linux-amd64-v1.15.1.gz > clash
    chmod -R 755 clash
    

clash进程管理

  1. clash单元文件

    vim /etc/systemd/system/clash.service
    
    [Unit]
    Description=Clash
    After=default.target network.target
    
    [Service]
    User=root
    Group=root
    Type=simple
    TimeoutStartSec=0
    ExecStart=/usr/local/clash/clash -d /usr/local/clash
    PrivateTmp=true
    Restart=always
    RestartSec=5
    StartLimitInterval=0
    
    [Install]
    WantedBy=multi-user.target
    
    ESC
    :wq
    
  2. clash进程管理

    # 开启
    systemctl enable clash
    systemctl restart clash
    systemctl status clash
    
  3. 配置防火墙

    systemctl unmask firewalld
    systemctl enable firewalld
    systemctl start  firewalld
    firewall-cmd --permanent --zone=public --add-port=7890/tcp
    firewall-cmd --permanent --zone=public --add-port=9090/tcp
    firewall-cmd --reload
    

clash更新订阅

  1. 每小时更新订阅
    0   *   *   *   *   wget --no-check-certificate -c <订阅链接> -O config.yaml
    1   *   *   *   *   systemctl restart clash
    

clash代理管理

  1. 永久开启代理

    vim /etc/profile
    
    export http_proxy="http://127.0.0.1:7890"
    export https_proxy="http://127.0.0.1:7890"
    export all_proxy="socks5://127.0.0.1:7890"
    export no_proxy="127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
    
    ESC
    :wq
    
    source /etc/profile
    
  2. 永久关闭代理

    vim /etc/profile
    
    # export http_proxy="http://127.0.0.1:7890"
    # export https_proxy="http://127.0.0.1:7890"
    # export all_proxy="socks5://127.0.0.1:7890"
    # export no_proxy="127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
    
    ESC
    :wq
    
    unset http_proxy
    unset https_proxy
    unset all_proxy
    unset no_proxy
    

clash管理界面

  1. 下载clash-dashboard

    cd /usr/local
    git clone -b gh-pages https://github.com/Dreamacro/clash-dashboard.git
    # 或
    cd /usr/local
    unzip clash-dashboard.zip
    
  2. 修改clash配置

    vim /usr/local/clash/config.yaml
    
    mixed-port: 7890
    allow-lan: false
    mode: Rule
    log-level: error
    external-controller: '0.0.0.0:9090'
    external-ui: /usr/local/clash-dashboard
    secret: QUNIMADASHABI
    
    ESC
    :wq
    
  3. 访问管理界面

    # IP_ADDR 取决于clash配置:“external-controller”
    systemctl restart clash
    http://IP_ADDR:9090/ui
    

clash附加说明

  1. 部分文件如果获取不到可以使用如下文件

    1. config.yaml

    2. Country.mmdb

    3. clash-dashboard

    4. clash-linux-amd64-v1.15.1.gz

Copyright © 鲸小鱼 2012-∞ all right reserved,powered by Gitbook修订: 2000-10-10 00:00

results matching ""

    No results matching ""