语音手机连接电脑操控AI编程
- 内容介绍
- 文章标签
- 相关推荐
手机语音操控 AI 编程搭建说明
场景说明
通过手机远程连接电脑,在移动端使用语音配合终端工具操控 AI 编程环境。
使用工具
- WireGuard
- 阿里云轻量应用服务器
- SSH
- Tmux
- Termius
工具作用说明
WireGuard:用于内网穿透和设备组网。阿里云服务器:作为中继节点,建立手机与电脑之间的稳定连接。SSH + Tmux:用于远程控制 AI 编程环境,并保持会话不中断。Termius:用于在手机端通过 SSH 连接 Mac。
工具安装位置
WireGuard:手机、服务器、电脑SSH + Tmux:电脑Termius:手机
搭建顺序
服务器 -> 电脑 -> 手机
服务器安装与配置
1. 切换管理员账号
sudo su
2. 安装 WireGuard (因为我用的阿里云服务器安装,镜像源有问题,所以禁用了一些,正常第三个命令即可)
sudo dnf config-manager --set-disabled docker-ce-stable,nodesource*
sudo dnf clean all && sudo dnf makecache
sudo dnf install -y wireguard-tools
3. 生成公私钥
服务端、电脑端、手机端都需要分别生成密钥:
wg genkey | tee server_private.key | wg pubkey > server_public.key
wg genkey | tee mac_private.key | wg pubkey > mac_public.key
wg genkey | tee phone_private.key | wg pubkey > phone_public.key
4. 服务器 wg0.conf 配置示例
将以下内容写入服务器的 wg0.conf,并替换为实际密钥信息:
[Interface]
PrivateKey = 服务器私钥
Address = 10.0.8.1/24
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
ListenPort = 51820
DNS = 8.8.8.8
MTU = 1420
# Mac
[Peer]
PublicKey = 电脑公钥
AllowedIPs = 10.0.8.2/32
PersistentKeepalive = 25
# Phone
[Peer]
PublicKey = 手机公钥
AllowedIPs = 10.0.8.3/32
PersistentKeepalive = 25
5. 启动或重启 WireGuard
设置开机启动:
sudo systemctl enable wg-quick@wg0
启动服务:
sudo systemctl start wg-quick@wg0.service
6. 配置服务器防火墙 (第一个没用Mosh可以不配置)
image2440×350 55.6 KB
电脑端配置
1. 安装 WireGuard 工具
brew install wireguard-tools
2. 创建配置目录
sudo mkdir -p /etc/wireguard
3. 编辑 wg0.conf
在电脑端创建并编辑 wg0.conf,内容格式如下,请自行替换密钥和服务器地址:
[Interface]
PrivateKey = 电脑私钥
Address = 10.0.8.2/32
[Peer]
PublicKey = 服务器公钥
AllowedIPs = 10.0.8.0/24
Endpoint = 服务器公网IP:51820
PersistentKeepalive = 25
4. 启动连接
sudo wg-quick down wg0 && sudo wg-quick up wg0
查看状态:
sudo wg
测试与服务器是否连通:
ping 10.0.8.1
手机端配置
1. 安装应用
安装 WireGuard。
2. 导入配置,并开启
在手机端添加对应的 WireGuard 配置。
image752×1552 114 KB
3. 安装Termius , 添加ssh命令连接即可(mac开启ssh并生成公私钥自行查下)
ssh mac名称@10.0.8.2 -p 22
使用方式
在Mac用任何终端 开启 tmux new-session -s 名称 , 进入登录Claude 或Codex
在Phone的Termius连上Mac 运行 tmux attach-session -t 名称
手机语言输入即可
如没有服务器等,可使用替换方式
WireGuard → Tailscale
协议替换(可能体验更好)
ssh → mosh
分屏工具
tmux → zellij
注意:
电脑熄屏和手机电池优化等需要设置,防止总断线。
网友解答:--【壹】--:
哇,感谢大佬
--【贰】--:
直接 uu 远程体验比你这个好还快 不信你试试
手机语音操控 AI 编程搭建说明
场景说明
通过手机远程连接电脑,在移动端使用语音配合终端工具操控 AI 编程环境。
使用工具
- WireGuard
- 阿里云轻量应用服务器
- SSH
- Tmux
- Termius
工具作用说明
WireGuard:用于内网穿透和设备组网。阿里云服务器:作为中继节点,建立手机与电脑之间的稳定连接。SSH + Tmux:用于远程控制 AI 编程环境,并保持会话不中断。Termius:用于在手机端通过 SSH 连接 Mac。
工具安装位置
WireGuard:手机、服务器、电脑SSH + Tmux:电脑Termius:手机
搭建顺序
服务器 -> 电脑 -> 手机
服务器安装与配置
1. 切换管理员账号
sudo su
2. 安装 WireGuard (因为我用的阿里云服务器安装,镜像源有问题,所以禁用了一些,正常第三个命令即可)
sudo dnf config-manager --set-disabled docker-ce-stable,nodesource*
sudo dnf clean all && sudo dnf makecache
sudo dnf install -y wireguard-tools
3. 生成公私钥
服务端、电脑端、手机端都需要分别生成密钥:
wg genkey | tee server_private.key | wg pubkey > server_public.key
wg genkey | tee mac_private.key | wg pubkey > mac_public.key
wg genkey | tee phone_private.key | wg pubkey > phone_public.key
4. 服务器 wg0.conf 配置示例
将以下内容写入服务器的 wg0.conf,并替换为实际密钥信息:
[Interface]
PrivateKey = 服务器私钥
Address = 10.0.8.1/24
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
ListenPort = 51820
DNS = 8.8.8.8
MTU = 1420
# Mac
[Peer]
PublicKey = 电脑公钥
AllowedIPs = 10.0.8.2/32
PersistentKeepalive = 25
# Phone
[Peer]
PublicKey = 手机公钥
AllowedIPs = 10.0.8.3/32
PersistentKeepalive = 25
5. 启动或重启 WireGuard
设置开机启动:
sudo systemctl enable wg-quick@wg0
启动服务:
sudo systemctl start wg-quick@wg0.service
6. 配置服务器防火墙 (第一个没用Mosh可以不配置)
image2440×350 55.6 KB
电脑端配置
1. 安装 WireGuard 工具
brew install wireguard-tools
2. 创建配置目录
sudo mkdir -p /etc/wireguard
3. 编辑 wg0.conf
在电脑端创建并编辑 wg0.conf,内容格式如下,请自行替换密钥和服务器地址:
[Interface]
PrivateKey = 电脑私钥
Address = 10.0.8.2/32
[Peer]
PublicKey = 服务器公钥
AllowedIPs = 10.0.8.0/24
Endpoint = 服务器公网IP:51820
PersistentKeepalive = 25
4. 启动连接
sudo wg-quick down wg0 && sudo wg-quick up wg0
查看状态:
sudo wg
测试与服务器是否连通:
ping 10.0.8.1
手机端配置
1. 安装应用
安装 WireGuard。
2. 导入配置,并开启
在手机端添加对应的 WireGuard 配置。
image752×1552 114 KB
3. 安装Termius , 添加ssh命令连接即可(mac开启ssh并生成公私钥自行查下)
ssh mac名称@10.0.8.2 -p 22
使用方式
在Mac用任何终端 开启 tmux new-session -s 名称 , 进入登录Claude 或Codex
在Phone的Termius连上Mac 运行 tmux attach-session -t 名称
手机语言输入即可
如没有服务器等,可使用替换方式
WireGuard → Tailscale
协议替换(可能体验更好)
ssh → mosh
分屏工具
tmux → zellij
注意:
电脑熄屏和手机电池优化等需要设置,防止总断线。
网友解答:--【壹】--:
哇,感谢大佬
--【贰】--:
直接 uu 远程体验比你这个好还快 不信你试试

