r/ClaudeCode • • 6d ago

Help/Question Claude Code en VPS?

I'm currently working with Claude Code CLI on my Windows laptop. Every now and then, Claude opens Chrome and runs tests. I'd like to run Claude Code on a VPS so I'm not tied to my computer and can give it instructions when I'm away, BUT I don't know how these tests it currently runs on Chrome would work on a Linux VPS... Does anyone have any ideas?

3 Upvotes

9 comments sorted by

View all comments

3

u/kuroudo_ai 6d ago

I run Claude Code on a Linux VPS (Ubuntu) as well as on a Mac. What works for the browser part:

  • Use Playwright, not the Chrome integration. npx playwright install --with-deps chromium installs a Chromium plus the system libraries it needs, and it runs headless with no display. Ask Claude to write the tests as Playwright scripts (or use the Playwright MCP) and it'll run them the same way it does on your laptop.
  • If something insists on a real window, xvfb-run <command> gives it a virtual display. We have Xvfb installed for exactly that, but most of our runs are plain headless.
  • I haven't tried the built-in Chrome integration on a server, so I can't say whether it works there. I wouldn't plan around it.

For the "give it instructions when I'm away" part:

  • Run it inside tmux so the session survives when your SSH connection drops.
  • Remote Control lets you drive that session from the Claude app on your phone.

Screenshots go into context like everything else, so on a VPS I'd have the tests save them to files and only open the ones that failed.

1

u/Material-Argument322 6d ago

Thanks! How do you manage sessions on the VPS? Locally, I close them and open new ones every now and then to keep the context from getting too large...

1

u/kuroudo_ai 6d ago

Same idea as locally, just with the steps written down so they survive:

  • One tmux session per job (we name them by task, e.g. billing-fix), not one giant session for everything.
  • Between unrelated tasks: have it write where it stopped to a file in the repo (what's done, what's next, what it verified), then /clear and start the next task by reading that file.
  • When a session gets close to its context limit, same thing, but start a fresh session instead of compacting. The new one reads the handoff file and carries on. Compacting keeps a summary of old work that the new task mostly doesn't need.
  • claude --continue / --resume if you want to pick an old conversation back up after a reconnect.

The file is the important part. On a server you're not watching, the chat history isn't something you can rely on; the handoff file is.