clash_for_linux/README.md
2023-01-31 17:07:50 +08:00

137 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 项目介绍
此项目是通过使用开源项目[clash](https://github.com/Dreamacro/clash)作为核心程序,再结合脚本实现简单的代理功能。
主要是为了解决我们在服务器上下载GitHub等一些国外资源速度慢的问题。
# 使用教程
### 下载项目
下载项目
```bash
$ git clone https://github.com/wanhebin/clash-for-linux.git
```
进入到项目目录,编辑`start.sh`脚本文件,修改变量`URL`的值。
```bash
$ cd clash-for-linux
$ vim start.sh
```
### 启动程序
直接运行脚本文件`start.sh`
- 进入项目目录
```bash
$ cd clash-for-linux
```
- 运行启动脚本
```bash
$ sh start.sh
Clash订阅地址可访问 [ OK ]
配置文件config.yaml下载成功 [ OK ]
服务启动成功! [ OK ]
Clash Dashboard 访问地址http://IP:9090/ui
Secretxxxxxxxxxxxxx
请执行以下命令加载环境变量: source /etc/profile.d/clash.sh
请执行以下命令开启系统代理: proxy_on
若要临时关闭系统代理,请执行: proxy_off
```
```bash
$ source /etc/profile.d/clash.sh
$ proxy_on
```
- 检查服务端口
```bash
$ netstat -tln | grep -E '9090|789.'
tcp 0 0 127.0.0.1:9090 0.0.0.0:* LISTEN
tcp6 0 0 :::7890 :::* LISTEN
tcp6 0 0 :::7891 :::* LISTEN
tcp6 0 0 :::7892 :::* LISTEN
```
- 检查环境变量
```bash
$ env | grep -E 'http_proxy|https_proxy'
http_proxy=http://127.0.0.1:7890
https_proxy=http://127.0.0.1:7890
```
以上步鄹如果正常说明服务clash程序启动成功现在就可以体验高速下载github资源了。
### 停止程序
- 进入项目目录
```bash
$ cd clash-for-linux
```
- 关闭服务
```bash
$ sh shutdown.sh
服务关闭成功请执行以下命令关闭系统代理proxy_off
```
```bash
$ proxy_off
```
然后检查程序端口、进程以及环境变量`http_proxy|https_proxy`,若都没则说明服务正常关闭。
### Clash Dashboard
- 访问 Clash Dashboard
通过浏览器访问 `start.sh` 执行成功后输出的地址例如http://192.168.0.1:9090/ui
- 登录管理界面
在`API Base URL`一栏中输入http://IP:9090 ,在`Secret(optional)`一栏中输入启动成功后输出的Secret。
点击Add并选择刚刚输入的管理界面地址之后便可在浏览器上进行一些配置。
- 更多教程
此 Clash Dashboard 使用的是[yacd](https://github.com/haishanh/yacd)项目详细使用方法请移步到yacd上查询。
# 使用须知
- 此项目不提供任何订阅信息请自行准备Clash订阅地址。
- 运行前请手动更改`start.sh`脚本中的URL变量值否则无法正常运行。
- 当前在RHEL系列和Debian系列Linux系统中测试过其他系列可能需要适当修改脚本。
- 支持 x86_64/aarch64 平台