返回顶部
b

browser-vps-setup-skillLinux VPS 浏览器配置

Set up a remote-controlled Chrome browser on a Linux VPS with noVNC visual access (via SSH tunnel) and optional authenticated HTTP proxy. Use when the user wants to run a browser on a VPS, control it remotely, view it via noVNC, or route browser traffic through a proxy.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
580
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

browser-vps-setup-skill

在VPS上设置浏览器

在Linux VPS上设置Chrome,以便:

  • - 代理可以通过OpenClaw浏览器工具控制它(打开页面、点击、填写表单、截图)
  • 用户可以通过本地浏览器中的noVNC观看和交互(通过SSH隧道)
  • 可选:所有流量通过经过身份验证的HTTP代理路由(用于反验证码)



步骤1:安装依赖

bash
apt-get install -y xvfb x11vnc novnc

安装真正的Google Chrome(不是snap——snap会破坏自动化)

wget https://dl.google.com/linux/direct/google-chrome-stablecurrentamd64.deb -O /tmp/chrome.deb apt-get install -y /tmp/chrome.deb || apt --fix-broken install -y

步骤2:启动浏览器堆栈

bash

清理过期锁文件


rm -f /tmp/.X99-lock ~/.openclaw/browser/openclaw/user-data/SingletonLock 2>/dev/null

虚拟显示器

Xvfb :99 -screen 0 1280x800x24 & sleep 2

VNC服务器(仅本地,无密码)

x11vnc -display :99 -forever -nopw -localhost -quiet & sleep 1

noVNC Web界面在端口6080(仅本地)

websockify --web /usr/share/novnc 6080 localhost:5900 & sleep 1

带CDP的Chrome在端口18800

DISPLAY=:99 google-chrome-stable --no-sandbox --disable-gpu \ --remote-debugging-port=18800 \ --user-data-dir=~/.openclaw/browser/openclaw/user-data \ --window-size=1280,800 &

步骤3:从笔记本电脑进行视觉连接

bash
ssh -L 6080:localhost:6080 root@YOURVPSIP

然后打开 http://localhost:6080/vnc.html → 点击 连接

您将看到Chrome窗口实时显示。您和代理可以同时控制它。



步骤4:配置OpenClaw

在 ~/.openclaw/openclaw.json 中添加:

json
{
browser: {
enabled: true,
executablePath: /usr/bin/google-chrome-stable,
attachOnly: true,
headless: false,
noSandbox: true
}
}

然后重启:openclaw gateway restart

代理现在可以使用 browser 工具进行导航、点击、输入、截图等操作。



步骤5(可选):经过身份验证的HTTP代理

如果您需要代理(例如用于反验证码的移动代理),Chrome无法在 --proxy-server 中传递用户名/密码。解决方案:运行一个本地Python桥接器,自动注入认证信息进行转发。

bash
python3 -c
import socket, threading, base64, select

UPSTREAMHOST = PROXYIP # 例如 87.236.22.82
UPSTREAMPORT = PROXYPORT # 例如 19423
USERNAME = PROXY_USER
PASSWORD = PROXY_PASS
LOCAL_PORT = 18801

auth = base64.b64encode(f{USERNAME}:{PASSWORD}.encode()).decode()

def handle(client):
try:
data = b
while b\r\n\r\n not in data:
data += client.recv(4096)
upstream = socket.createconnection((UPSTREAMHOST, UPSTREAM_PORT))
if bProxy-Authorization not in data:
data = data.replace(b\r\n\r\n, f\r\nProxy-Authorization: Basic {auth}\r\n\r\n.encode(), 1)
upstream.sendall(data)
while True:
r, , = select.select([client, upstream], [], [], 30)
if not r: break
for s in r:
d = s.recv(65536)
if not d: return
(upstream if s is client else client).sendall(d)
except: pass
finally:
try: client.close()
except: pass
try: upstream.close()
except: pass

srv = socket.socket()
srv.setsockopt(socket.SOLSOCKET, socket.SOREUSEADDR, 1)
srv.bind((127.0.0.1, LOCAL_PORT))
srv.listen(50)
print(本地代理在 127.0.0.1:18801)
while True:
c, _ = srv.accept()
threading.Thread(target=handle, args=(c,), daemon=True).start()
&

然后使用代理重启Chrome:

bash
pkill -9 chrome
rm -f ~/.openclaw/browser/openclaw/user-data/SingletonLock
DISPLAY=:99 google-chrome-stable --no-sandbox --disable-gpu \
--remote-debugging-port=18800 \
--user-data-dir=~/.openclaw/browser/openclaw/user-data \
--window-size=1280,800 \
--proxy-server=http://127.0.0.1:18801 &

验证:让代理打开 https://api.ipify.org — 它应该显示代理IP,而不是VPS IP。



防火墙(推荐)

bash
ufw default deny incoming
ufw default allow outgoing
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw --force enable

noVNC(6080)、VNC(5900)和CDP(18800)都仅限于本地 — 从不公开暴露。



重启后

所有进程(Xvfb、x11vnc、websockify、Chrome)都必须重新启动。让代理执行:

在VPS上启动浏览器堆栈

代理应运行此技能中的步骤2命令。

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 browser-vps-setup-skill-1776419960 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 browser-vps-setup-skill-1776419960 技能

通过命令行安装

skillhub install browser-vps-setup-skill-1776419960

下载

⬇ 下载 browser-vps-setup-skill v1.0.0(免费)

文件大小: 2.95 KB | 发布时间: 2026-4-17 18:54

v1.0.0 最新 2026-4-17 18:54
Initial release: Easily set up a remotely controllable Chrome browser on a Linux VPS with noVNC visual access and optional authenticated proxy.

- Provides detailed steps to install, run, and access Chrome via noVNC on Ubuntu/Debian VPS.
- Enables simultaneous control by both agent (automation) and user (visual/interactive via browser).
- Includes config for integration with OpenClaw agents.
- Offers an optional local Python proxy bridge for authenticated HTTP proxies.
- Security note: visual access and control ports are localhost-only; includes recommended firewall settings.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部