Developers who want a remote coding-agent workspace
Use a VPS when repositories, branches, package managers, and terminal sessions need a stable server location.
This guide explains how to run Claude Code on a VPS so the runtime can live in a persistent remote environment instead of depending on a local machine. Virtarix provides the VPS infrastructure: NVMe storage, full root access, global locations, and an always-on server environment. You bring your own Claude Code access, repository permissions, project credentials, tools, and configuration.
This page is for users who want Claude Code work to run from a controlled VPS workspace instead of relying only on a local desktop session.
Use a VPS when repositories, branches, package managers, and terminal sessions need a stable server location.
Keep coding-agent experiments, build output, and test logs away from sensitive workstation files.
Keep project files, run history, generated artifacts, and troubleshooting evidence in one reachable environment.
Virtarix supplies self-managed VPS infrastructure; you handle Claude Code authentication, installation, updates, monitoring, and security.
Before selecting a plan or installing Claude Code, confirm the server access, runtime path, credentials, firewall exposure, and recovery routine needed for the deployment.
A Linux VPS, such as Ubuntu or Debian, supported by the Claude Code install path and the repositories you plan to work on.
SSH access to the server.
Root or sudo access.
Basic terminal knowledge.
Git and the package managers required by Claude Code.
Docker only if the project repository, dev container, or a deliberately secured automation wrapper requires it; the normal Claude Code terminal workflow does not require Docker Compose.
Project-specific runtimes only when your repository or selected Claude Code install path requires them.
Claude Code access through an eligible Claude account or supported third-party provider path, plus your own repositories, project credentials, and configuration.
Firewall rules for SSH and any separate development service you intentionally expose. Claude Code itself is normally used from the terminal inside the VPS workspace.
Backups or snapshots before production use or major upgrades.
Before running commands, decide how Claude Code should be installed, updated, restarted, and recovered on the VPS. Use current upstream documentation as the authority for exact versions and flags.
Minimum starting point for a test environment:
The VPS is the runtime layer. You connect over SSH, configure Claude Code, keep logs and runtime state on the server, and control API or model provider access yourself. For sizing context, return to Claude Code VPS hosting before moving from test to production use.
Operator or developer controlling the workflow.
Secure access into the server.
Runtime, storage, network, and package layer.
Claude Code runtime layer for the workflow.
External model access and provider credentials.
Code, automation tools, messaging gateways, and webhooks.
Follow this sequence as a practical deployment checklist, but confirm Claude Code-specific versions, installer flags, and service commands against current official documentation before production use.
Prepare the VPS, connect over SSH, and create a clean workspace before installing Claude Code and project-specific dependencies.
ssh root@YOUR_SERVER_IP
sudo apt update && sudo apt upgrade -y
Log back in as the non-root user before continuing if your security policy requires it.
adduser deployusermod -aG sudo deploy
Create one directory tree for Claude Code config examples, working files, logs, and backups. Keep secrets out of shell history and commit only templates, not real keys.
APP_HOME="$HOME/run-claude-code-on-vps-runtime"mkdir -p "$APP_HOME/config" "$APP_HOME/workspace" "$APP_HOME/logs" "$APP_HOME/backups"chmod 700 "$APP_HOME/config"printf '%s\n' "# add real provider keys privately" > "$APP_HOME/config/env.example"chmod 600 "$APP_HOME/config/env.example"
Install base packages, follow the current upstream install path, and configure runtime/environment settings.
sudo apt install -y git curl wget unzip ca-certificates gnupg
Claude Code official setup lists native installation, Linux package repositories, and an npm package option. Node.js may still be relevant for your projects or for the npm install path, but the installed claude binary itself should be treated as the coding tool, not as a long-running web service. Use official Claude Code documentation to confirm exact versions before relying on the server setup.
Claude Code official setup documents several supported platforms, but this VPS guide should follow the Linux server path first. Install Claude Code, confirm the CLI, then complete the interactive login or provider flow before starting work in a project directory.
# Linux install command from Claude Code quickstartcurl -fsSL https://claude.ai/install.sh | bash# Confirm the CLI is available, then authenticate interactivelyclaude --versionclaude
For Claude Code, authenticate through the documented account or provider flow first. Keep project-specific secrets in the project’s normal secret-management path, not in a generic .env created only for Claude Code.
claude --versionclaude doctorclaude
Claude Code is normally started inside the repository workspace as an interactive terminal coding session. Use a service manager only for a separate wrapper or automation that you have designed and secured; do not present Claude Code itself as a generic daemon.
# Example repository workflow after authenticationgit clone YOUR_REPOSITORY_URLcd YOUR_REPOSITORY_DIRECTORYclaude
Keep the VPS workspace reachable, secure SSH and project access, validate Claude Code authentication, and maintain the project environment over time.
Claude Code is usually an interactive terminal process, not a background service. Keep the VPS available over SSH, use tmux or screen when you need a resilient terminal session, and reserve Docker/systemd for separate project services or explicitly designed headless automation wrappers.
tmux new -s claude-codecd YOUR_REPOSITORY_DIRECTORYclaude
Claude Code benefits from a VPS when project files, Git branches, build tools, and terminal sessions should live in a server environment that can be reached over SSH.
Keep project repositories, dependency installs, generated files, terminal history, and build logs on an always-on server.
Use the VPS as a deliberate coding-agent boundary instead of mixing experiments with personal files and local credentials.
Document the packages, runtimes, users, firewall rules, and repository paths that make the Claude Code environment work.
Treat the VPS as a clean development machine. Keep SSH access tight, use project-specific repositories, and avoid storing more credentials on the server than the coding workflow requires.
Read the Claude Code article for feature context, practical workloads, and VPS-hosting fit before you choose the setup path.
Compare adjacent AI agent frameworks when you want broader context before choosing a VPS runtime or setup guide.
Treat the Claude Code server as a privileged runtime. Security should be part of the setup, not a later cleanup task.
Use SSH keys where possible.
Keep root login limited.
Use a non-root user where practical.
Restrict ports.
Store secrets in environment variables or a secret manager.
Avoid committing .env files.
Review SSH logs, repository access, Claude authentication state, shell history, package-manager activity, build output, and project-specific secret storage.
Keep packages updated.
Snapshot before major Claude Code changes.
Monitor failed login attempts.
Rotate exposed keys.
Keep experiments separate from production systems.
The server can contain Claude access, repositories, terminal sessions, project secrets, build output, and runtime logs. Harden it before production use.
Common setup problems to check before blaming the VPS or framework.
Server firewall, wrong IP, or SSH service unavailable Confirm the VPS is running, check the IP, and verify port 22 or your configured SSH port.
Wrong key, wrong user, or disabled login method
Check ~/.ssh/authorized_keys, user permissions, and your SSH config.
Base packages or runtime packages were not installed Re-run the dependency step and compare runtime versions with official Claude Code docs.
The selected project or Claude Code npm install path expects a different runtime version Use the version manager or package source recommended by upstream docs.
Docker daemon stopped or not installed Start Docker only if your project, dev container, or wrapper workflow actually requires it, then inspect the logs for that project-specific path.
Claude Code was started in a normal SSH shell Use tmux or screen for interactive continuity, or build a secured automation wrapper if you need non-interactive execution.
A project dev server, tunnel, preview app, or wrapper service is bound to the same port
Run ss -tulpn and move one service to a different port; Claude Code itself is normally a terminal workflow, not a listening web service.
A required project, preview, tunnel, or wrapper port is not open Open only the required project-specific port and keep all other ports restricted.
Configuration is absent or incomplete Compare the generated configuration with the selected deployment path and add only the secrets and paths required.
Key is wrong, expired, or lacks access Rotate the key through the provider and update the server configuration.
Logs, caches, or repositories grew over time
Check df -h, rotate logs, clean caches, and scale storage if needed.
Too many build processes, test runners, package installs, or parallel coding sessions Reduce concurrency, inspect process memory, and scale the VPS if the workload is valid.
Deploy a Claude Code VPS and use this guide as your review checklist while you prepare the setup.