网站建设中,中国大陆地区请使用VPN访问,欢迎提建议,关注LSKR Mastodon

Clash for Linux下载、快速配置与使用教程

实现在linux系统上安装、配置和使用clash,一个强大的代理工具。

本文从实战角度出发教你一步步实现 Linux上的 Clash for Linux

问题描述

对于程序员很多包国外的都需要代理,比如入门的时候,ubuntu apt总是卡断,很多人可能使用像阿里的镜像地址,但是我们更多的推荐使用设置代理,为什么,应为很多情况下,有些包镜像地址也不提供。可以放心发访问google 对于程序员永远是重要的。

项目地址

 $ git clone https://github.com/wanhebin/clash-for-linux.git

进入到项目目录,编辑.env文件,修改变量CLASH_URL的值(你购买的Clash 的订阅地址)。

 $ cd clash-for-linux
 $ vim .env

注意: .env 文件中的变量 CLASH_SECRET 为自定义 Clash Secret,值为空时,脚本将自动生成随机字符串。

启动程序

直接运行脚本文件start.sh

进入项目目录

 $ cd clash-for-linux

运行启动脚本

 $ sudo bash start.sh

 $ source /etc/profile.d/clash.sh
 $ proxy_on

检查服务端口

 $ netstat -tln | grep -E '9090|789.'

检查环境变量

 $ env | grep -E 'http_proxy|https_proxy'

检查环境变量

 $ env | grep -E 'http_proxy|https_proxy'

以上步鄹如果正常,说明服务clash程序启动成功,现在就可以体验高速下载Github资源了。

重启程序

如果需要对Clash配置进行修改,请修改 conf/config.yaml 文件。然后运行 restart.sh 脚本进行重启。

注意:

重启脚本 restart.sh 不会更新订阅信息。

停止程序

进入项目目录

 $ cd clash-for-linux

关闭服务

 $ sudo bash shutdown.sh
 #服务关闭成功,请执行以下命令关闭系统代理:proxy_off
 $ proxy_off

然后检查程序端口、进程以及环境变量http_proxy|https_proxy,若都没则说明服务正常关闭。

Clash Dashboard

访问 Clash Dashboard

Clash Dashboard 访问地址: http://<ip>:9090/ui (服务器地址)。

登录管理界面

API Base URL一栏中输入:http://\<ip\>:9090 ,在Secret(optional)一栏中输入启动成功后输出的Secret。

点击Add并选择刚刚输入的管理界面地址,之后便可在浏览器上进行一些配置。

更多教程

此 Clash Dashboard 使用的是yacd项目,详细使用方法请移步到yacd上查询。

测试

是否可以访问

 curl www.google.com

参考

[1] https://github.com/wanhebin/clash-for-linux

[2] https://photos.app.goo.gl/D1YTNUoSdGaXy8ys7


إرسال تعليق

Cookie Consent
我们使用 Cookie 来了解您如何使用我们的网站并提升您的体验。这包括个性化内容和广告。
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.