ghostxu97 / clash-for-linux

Linux环境安装配置Clash工具,以实现代理上网效果。包含下载、安装、配置、运行、测试以及开机自启动、定期自动更新订阅功能的操作文档,希望对你有所帮助
374 stars 65 forks source link

命令行形式开启报错 #22

Open tiansiyuan opened 1 week ago

tiansiyuan commented 1 week ago
三、启用系统代理
命令行形式开启
[root@localhost ~]# gsettings set org.gnome.system.proxy mode 'manual'
[root@localhost ~]# gsettings set org.gnome.system.proxy.http port 7890
[root@localhost ~]# gsettings set org.gnome.system.proxy.http host '127.0.0.1'
[root@localhost ~]# gsettings set org.gnome.system.proxy.socks port 7891
[root@localhost ~]# gsettings set org.gnome.system.proxy.socks host '127.0.0.1'
[root@localhost ~]# gsettings set org.gnome.system.proxy ignore-hosts "['localhost', '127.0.0.0/8', '::1']"
(process:1565049): dconf-WARNING **: 14:08:36.194: failed to commit changes to dconf: Cannot autolaunch D-Bus without X11 $DISPLAY

因为我用的是阿里云的 VM,没有装 X11。怎么破?

ghostxu97 commented 1 week ago

配置环境变量

  1. 设置HTTP和SOCKS5代理

    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:7891"
  2. 将这些变量添加到~/.bashrc~/.zshrc中以使其永久生效

    echo 'export http_proxy="http://127.0.0.1:7890"' >> ~/.bashrc
    echo 'export https_proxy="http://127.0.0.1:7890"' >> ~/.bashrc
    echo 'export all_proxy="socks5://127.0.0.1:7891"' >> ~/.bashrc
    source ~/.bashrc
tiansiyuan commented 1 week ago

感谢解答。

我在一个终端里运行:

sudo ./clash -d .
INFO[0000] Start initial compatible provider ChatGPT专线  
INFO[0000] Start initial compatible provider 香港智能       
INFO[0000] Start initial compatible provider 全球智能       
INFO[0000] Start initial compatible provider Ghelper

在一个终端里运行:

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:7891"

curl www.google.com
curl: (7) Failed to connect to 127.0.0.1 port 7890 after 0 ms: Couldn't connect to server
ghostxu97 commented 1 week ago

clash服务开启了吗

tiansiyuan commented 1 week ago

clash服务开启了吗

sudo ./clash -d . INFO[0000] Start initial compatible provider ChatGPT专线
INFO[0000] Start initial compatible provider 香港智能
INFO[0000] Start initial compatible provider 全球智能
INFO[0000] Start initial compatible provider Ghelper

是这样开启吧?

Timson020 commented 6 days ago

服务形式启动失败... 确定路径都没错的。 进入目录后,运行./clash -d . 才可以正常运行.

没办法 systemctl start clash.service启动