Linux安装clash
作者QQ:67065435 QQ群:669756510
本站内容全部为作者原创,转载请注明出处!
安装clash
- 创建项目文件
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进程管理
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 :wqclash进程管理
# 开启 systemctl enable clash systemctl restart clash systemctl status clash配置防火墙
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更新订阅
- 每小时更新订阅
0 * * * * wget --no-check-certificate -c <订阅链接> -O config.yaml 1 * * * * systemctl restart clash
clash代理管理
永久开启代理
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永久关闭代理
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管理界面
下载clash-dashboard
cd /usr/local git clone -b gh-pages https://github.com/Dreamacro/clash-dashboard.git # 或 cd /usr/local unzip clash-dashboard.zip修改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访问管理界面
# IP_ADDR 取决于clash配置:“external-controller” systemctl restart clash http://IP_ADDR:9090/ui
clash附加说明
部分文件如果获取不到可以使用如下文件