Mihomo远程部署
Mihomo远程部署 前言 因为在WSL中需要下载一些东西,而因为电脑又在远程,无法使用GUI,且如果直接调用Windows中的Mihomo,会导致ssh无法正常连接,故在此直接在WSL中部署Mihomo。 工作环境 WSL2环境 Tailscale SSH 步骤 下载Mihomo 此部分不要直接完全复制,请根据最新版本替换链接 # 创建目录 mkdir ~/mihomo && cd ~/mihomo # 下载链接,根据最新链接进行替换,注意应选择mihomo-linux-amd64-vx.xx.x.gz wget https://github.com/MetaCubeX/mihomo/releases/download/v1.18.9/mihomo-linux-amd64-v1.18.9.gz # 解压并重命名 gunzip mihomo-linux-amd64-v1.18.9.gz mv mihomo-linux-amd64-v1.18.9 mihomo chmod +x mihomo 配置核心文件 下载地理文件 这个文件一般Mihomo在初次运行时会自动下载,但是经常失败,所以直接手动下载 wget -O Country.mmdb https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb 配置设置文件 你应该会有一个订阅链接,通过这个订阅链接可以下载一个config.yaml文件,使用以下语句进行下载: curl -L -o config.yaml "https://api.v1.mk/sub?target=clash&url=你的订阅链接" 初步测试 ./mihomo -d . 如果一切正常,应该会看到Start initial configuration successful之类的内容,并且在shell中它展开了一个服务。 常驻后台 移动文件 将Mihomo文件移动到/usr/local/bin中,这样就可以直接使用mihomo命令了。 sudo mv mihomo /usr/local/bin/ sudo mkdir -p /etc/mihomo sudo cp Country.mmdb /etc/mihomo/ sudo cp config.yaml /etc/mihomo/ 使用systemd守护进程 创建服务文件sudo nano /etc/systemd/system/mihomo.service ...