一键安装 Clash 代理工具及其配置。
clash-install/ ├── install.sh # 安装脚本 ├── gnome-proxy.sh # GNOME 系统代理控制脚本 ├── bashrc_additions.txt # .bashrc 配置片段 └── clash/ ├── clash # clash 二进制文件 ├── config.yaml # clash 配置文件 (需手动配置) ├── Country.mmdb # GeoIP 数据库 ├── LICENSE └── README.md
# 下载并解压本仓库
cd clash-install
# 执行安装
bash install.sh
# 将配置添加到 ~/.bashrc
cat bashrc_additions.txt >> ~/.bashrc
# 重新加载
source ~/.bashrc
复制你的 Clash 配置文件到正确位置:
cp -f clash/config.yaml ~/.config/clash/config.yaml
注意:
config.yaml包含代理账户信息,请使用你自己的配置文件覆盖。
# 前台运行
clash
# 或后台运行
clash &
# 开启代理
gproxy on
# 关闭代理
gproxy off
# 查看状态
gproxy status
proxy_on # 开启终端代理
proxy_off # 关闭终端代理
proxy_status # 查看代理状态
~/gnome-proxy.sh on # 开启系统代理
~/gnome-proxy.sh off # 关闭系统代理
~/gnome-proxy.sh status # 查看状态
~/gnome-proxy.sh toggle # 切换状态
# 或使用快捷命令 (需先配置 .bashrc)
gproxy on
gproxy off
gproxy status
gproxy toggle
clash/config.yaml 是模板文件,包含示例配置。安装后需要替换为你自己的配置文件。install.sh 安装,再配置 config.yaml。gnome-proxy.sh 依赖 gsettings,仅适用于 GNOME 桌面环境。手动删除以下内容:
rm -f ~/.local/bin/clash
rm -f ~/gnome-proxy.sh
# ~/.config/clash/ 目录可根据需要保留或删除