Sneakydog-demo / sneakydog-demo.github.io

Sneakydog-demo
http://myhxh.xyz
0 stars 0 forks source link

clash install #7

Open fuzhoudong opened 2 years ago

fuzhoudong commented 2 years ago

一、官方网站 clash 下载clash-linux-amd64-v1.7.1.gz

打开终端进入下载的文件夹(我的在此文件夹,username为用户文件夹)

cd /home/username/下载

gunzip clash-linux-amd64-v1.7.1.gz
mv clash-linux-amd64-v1.7.1 clash
mkdir Clash 
mv clash ./Clash

二、进入新建的这个Clash文件夹,下载config.yaml和Country.mmdb

#下载clash 配置文件config.yaml 在代理商那里复制订阅链接,替代 [订阅链接]
wget -O config.yaml [订阅链接]
#下载Country.mmdb 
wget -O Country.mmdb https://www.sub-speeder.com/client-download/Country.mmdb

三、启动clash(使用当前目录下的配置文件)以下两个操作同步

授权可执行权限

chmod +x clash

可启动 Clash,同时启动 HTTP 代理和 Socks5 代理 ./clash -d . 出现如下(保持此终端打开):

INFO[0000] Start initial compatible provider Domestic
INFO[0000] Start initial compatible provider AsianTV
INFO[0000] Start initial compatible provider GlobalTV
INFO[0000] Start initial compatible provider Others
INFO[0000] Start initial compatible provider Proxy

(2)访问 http://clash.razord.top/ 可以进行切换节点、测延迟等操作。

打开配置文件config.yaml ,给它设置一个密码: # RESTful API 的口令 secret: '123456'

这个页面要求提供,Host,Port,Secret 三个输入:

Host: 127.0.0.1
Port: 9090
Secret: 123456 

打开系统设置,选择网络,点击网络代理右边的 ⚙ 按钮,选择手动,填写 HTTP 和 HTTPS 代理为 127.0.0.1:7890,填写 Socks 主机为 127.0.0.1:7891,即可启用系统代理。(注意:冒号后的数字写后面)

注意:要访问谷歌,就要时刻打开那个终端

四、配置开机自启动

打开终端,获取权限

su 
#输入密码
#创建service文件
touch /etc/systemd/system/clash.service
#编辑service文件 
vi /etc/systemd/system/clash.service 
#编辑如下文本: 
[Unit]
Description=clash daemon
[Service]
Type=simple
User=root
ExecStart=/clash
Restart=on-failure 
[Install]
WantedBy=multi-user.target