服务器实现魔法上网

安装Clash-Core(实现科学上网)

https://github.com/Dreamacro/clash

先去下一个 clash

gunzip 下载的

重命名

mv clashxxx-xxx-vxxx clash

在opt目录下新建clash文件夹,将刚刚解压的放进去

mkdir /opt/clash

mv clash /opt/clash/

运行指定配置文件

cd /opt/clash

./clash -f config.yml

如果没有指定文件,会在 ~/.config/clash/目录下生成默认配置

编辑成系统服务?

vim /etc/systemd/system/clash.service

1
2
3
4
5
[Unit]
Description=Clash-core
[Service]
Type=simple
ExecStart=/opt/clash/clash -f /opt/clash/config.yml

执行

systemctl daemon-reload

systemctl start clash

systemctl ststus clash

Calsh Dashbord

再新建一个文件夹 ui

下载这个仓库的文件 https://github.com/Dreamacro/clash-dashboard/tree/gh-pages

clash-dashboard-gh-pages.zip

解压 unzip clash-dashboard-gh-pages.zip

删掉 zip文件

rm -rf clash-dashboard-gh-pages.zip

把文件移动出来

mv clash-dashboard-gh-pages/* .

回到 clash菜单编辑 config.yml文件

改以下两行

1
2
external-controller: 0.0.0.0:9090
external-ui: /opt/clash/ui