Skip to main content
99.99% Uptime SLA Network status

How to Run Claude Code on a VPS

Run Claude Code from a self-managed VPS when you need a persistent remote coding workspace with SSH, Git, tmux, NVMe storage, snapshots, and controlled repository access. Use this guide to deploy the server, install Claude Code through the official setup path, authenticate with your own Claude access, clone a repository, and keep the workspace available over SSH.

20% welcome offer $4.40/mo for first 3 months (then $5.50)
Trustpilot rating: 4.5 out of 5 4.5/5 on Trustpilot

Recommended Quick Setup

Use this path when you want the shortest practical route from VPS order to a usable Claude Code server workspace. The full checklist below expands each step.

01

VPS plan

Starter VPS includes 3 CPU cores, 6 GB RAM, 50 GB NVMe storage, Unlimited bandwidth (policy applies), 1 free snapshot, 1 backup included, IPv4 + IPv6.

02

Operating system

Choose Ubuntu 20.04+, Debian 10+, or another Linux path currently supported by Claude Code and your project dependencies.

03

Access method

Connect with SSH keys where possible, create a non-root user for project work, restrict exposed ports, and keep only the project services you need reachable.

04

Runtime workflow

Install Claude Code using the current official setup path, authenticate with your own eligible Claude or provider account, clone only the required repository, and run Claude Code inside the project workspace.

05

Session continuity

Use tmux or screen when you need to disconnect and resume work later. Treat Docker, systemd, cron, or queues as project-service tools, not as the default Claude Code runtime.

06

Safety checkpoint

Take a snapshot before major dependency changes, protect provider keys and repository credentials, run claude doctor, test one small prompt, then scale the VPS only after measuring real CPU, RAM, storage, and build activity.

Who This Guide Is For

This guide is for technical users who want Claude Code work to live inside a controlled Linux server workspace, with repository state, dependencies, logs, and SSH access kept away from a local workstation.

Developers who want a remote coding-agent workspace

Use a VPS when repositories, branches, package managers, terminal sessions, and generated files should stay in one stable server environment.

Teams testing agent changes away from local machines

Keep coding-agent experiments, build output, and test logs away from sensitive workstation files and personal credentials.

Operators who need persistent project state

Keep project files, run history, generated artifacts, rollback notes, and troubleshooting evidence in one reachable environment.

Technical users managing Claude Code themselves

Virtarix supplies the VPS layer. You remain responsible for Claude Code authentication, installation, updates, monitoring, usage costs, repository access, and security.

What You Need Before You Start

Before selecting a plan or installing Claude Code, confirm the server access, authentication path, repository permissions, firewall exposure, and recovery routine required for your deployment.

Choose the Claude Code Runtime Path

Before running commands, choose one installation and update path for the VPS. Use the current Claude Code setup page for exact package sources, flags, authentication, and update behavior.

Native installer

Best first path for a normal Linux VPS workflow where Claude Code runs from a remote project workspace in the terminal.

Linux package manager

Useful when operations policy prefers apt, dnf, or apk based installation and manual package upgrades.

npm package

Useful when Node and npm are centrally managed for the project and the team accepts the npm-based install path.

Scripted non-interactive use

Use only for reviewed automation wrappers that run a narrow task and exit after authentication, permissions, current CLI flags, repository boundaries, and rollback behavior have been verified.

Recommended VPS Requirements

Use these requirements as a practical starting point for a remote Claude Code workspace. Increase resources after measuring repository size, package installs, build processes, test runners, logs, and concurrent sessions.

Minimum starting point for a test environment

Use this to validate the workflow before committing to an always-on deployment.

  • 2 CPU cores
  • 4 GB RAM
  • 30 GB NVMe storage
  • Ubuntu 20.04+, Debian 10+, or another current Claude Code-supported Linux path
  • x64 or ARM64 processor
  • Root or sudo access
  • Internet access for authentication and AI processing

Recommended Virtarix starting point

Starter VPS

20% off your first 3 months - normally $5.50/month

  • 3 CPU cores
  • 6 GB RAM
  • 50 GB NVMe storage
  • Unlimited bandwidth*
  • 1 free snapshot
  • 1 backup included
  • IPv4 + IPv6
  • Full root access

Recommended Architecture

The VPS is the remote workspace layer. You connect over SSH, install Claude Code using a supported path, keep repositories and logs on the server, and control Claude access, provider credentials, Git permissions, and project services yourself.

You (Operator)

You connect over SSH and control the workflow, prompts, repositories, credentials, approvals, and access decisions.

Virtarix VPS

Provides the persistent Linux server with storage, networking, root access, snapshots, backups, SSH sessions, and package runtime.

Claude Code Runtime

Claude Code and supporting project tooling running inside the remote workspace you install, authenticate, and configure.

External Services

Claude or model provider access, Git repositories, APIs, tools, and deployment targets reached through the credentials you configure.

Step-by-Step Setup Flow

Follow this sequence as the detailed VPS deployment checklist. It expands the quick setup above into the actual connection, install, authentication, security, and maintenance steps.

Deploy and connect

Prepare the VPS, connect over SSH, update packages, and create a clean workspace before installing Claude Code and project-specific dependencies.

Deploy the VPS

Choose Ubuntu, Debian, or another supported Linux path. Select the region closest to the user, team, repository services, application, or provider where practical. Start with enough CPU, RAM, and NVMe storage for repository work, dependency installs, logs, and build output.

Connect over SSH

ssh root@YOUR_SERVER_IP

Update the server

sudo apt update && sudo apt upgrade -y

Create a non-root user where practical

Create a dedicated non-root deployment user for day-to-day project work, then verify that user can connect by SSH and run sudo before disabling root or password login. Reconnect as the deployment user before installing or configuring the agent when your selected runtime path stores user-scoped configuration.

# Create a dedicated non-root user for day-to-day project work
adduser deploy
usermod -aG sudo deploy

Prepare a private runtime workspace

Create one directory tree for working files, project logs, backups, and examples. Keep real secrets out of shell history and commits.

APP_HOME="$HOME/claude-code-vps-workspace"
mkdir -p "$APP_HOME/config" "$APP_HOME/repos" "$APP_HOME/logs" "$APP_HOME/backups"
chmod 700 "$APP_HOME/config"
printf '%s\n' "# store real provider keys only in your approved secret-management path" > "$APP_HOME/config/env.example"
chmod 600 "$APP_HOME/config/env.example"

Install and configure

Install base packages, follow the current official Claude Code Linux setup path, and configure authentication and project access.

Install base dependencies

sudo apt install -y git curl wget unzip ca-certificates gnupg tmux

Confirm system requirements

Confirm operating system support, RAM, processor architecture, internet access, shell support, location eligibility, and project-specific runtime dependencies before installation. Claude Code setup documentation

Install Claude Code

Use the install command for your selected path. The native Linux installer is the default starting point for a normal VPS terminal workflow; package-manager and npm paths may fit stricter operations policies.

# Native Linux install path shown in the current Claude Code setup page
curl -fsSL https://claude.ai/install.sh | bash

# Open a new shell if required, then confirm the CLI is available
claude --version

Security note: The official installer is fetched from https://claude.ai/install.sh. Review the current script and official documentation at https://claude.ai/docs before running, or download and inspect it first.

Authenticate Claude Code

Authenticate through the documented account, organization, or provider flow. Keep Claude authentication state and project credentials protected, and do not store unrelated keys on the VPS.

claude
claude doctor

Prepare repository access

Use the repository access method approved for your team: SSH deploy keys, Git provider authentication, short-lived credentials, or another reviewed path. Clone only the repositories required for the work.

git clone YOUR_REPOSITORY_URL
cd YOUR_REPOSITORY_DIRECTORY

Start Claude Code in the project workspace

Claude Code is normally started inside a repository as an interactive terminal coding session. Do not present Claude Code itself as a generic background daemon.

cd YOUR_REPOSITORY_DIRECTORY
claude

Run, secure, and maintain

Keep the VPS workspace reachable, secure SSH and project access, validate authentication, monitor resource usage, and maintain the environment over time.

Keep the terminal session available

Use tmux or screen when you need to disconnect and resume an interactive terminal session later. Reserve Docker, systemd, cron, or queues for separate project services or explicitly designed wrappers.

tmux new -s claude-code
cd YOUR_REPOSITORY_DIRECTORY
claude

Secure the VPS

Use SSH keys where possible, limit root login, restrict password login when practical, enable a firewall, expose only required ports, protect secret files, protect Claude authentication state, keep packages updated, and snapshot before major changes.

Test the setup

Confirm claude --version works, run claude doctor, authenticate successfully, open a repository, run a small controlled prompt, restart the SSH session, resume tmux if used, and confirm workspace state and credentials behave as expected.

Maintain it over time

Review Claude Code diagnostics, shell history, SSH logs, package updates, repository permissions, disk usage, RAM and CPU usage, project logs, dependency updates, snapshot timing, and rollback notes.

Why Claude Code Benefits from a VPS

Claude Code benefits from a VPS when project files, Git branches, build tools, generated output, and terminal sessions should live in a server environment that can be reached over SSH.

01

Persistent remote development workspace

Keep project repositories, dependency installs, generated files, terminal history, and build logs on an always-available server workspace.

02

Cleaner separation from local files

Use the VPS as a deliberate coding-agent boundary instead of mixing experiments with personal files and local workstation credentials.

03

Reproducible server context

Document the packages, runtimes, users, firewall rules, repository paths, and shell setup that make the Claude Code environment work.

04

Controlled authentication and access

Treat the VPS as a clean development machine. Keep SSH access tight, use project-specific repository permissions, and avoid storing more credentials than the workflow requires.

Security Basics for Claude Code on a VPS

Privileged runtime

The VPS can contain Claude access, repositories, project secrets, terminal history, build output, and runtime logs. Harden it before production use.

Troubleshooting

Use these checks to isolate whether the issue is SSH access, Claude Code installation, authentication, project runtime, firewall exposure, or VPS resources.

SSH access

SSH connection refused

Confirm the VPS is running, check the IP address, and verify port 22 or your configured SSH port is open and allowed by the server firewall.

Permission denied

Check the SSH user, key, ~/.ssh/authorized_keys, file permissions, SSH config, and your chosen login policy.

Claude Code installation and authentication

claude command not found

Open a new shell, confirm the install completed, and check that the Claude Code binary path is available to the user account running the session.

claude doctor reports an issue

Follow the diagnostic output first, then check installation method, settings, authentication, MCP configuration, and shell environment.

Authentication fails

Confirm the account type, organization access, provider path, supported location, and network path used for the VPS login flow.

Project runtime and dependencies

Missing dependencies

Re-run the base dependency step, then compare project runtime versions against the repository requirements.

Project runtime mismatch

Use the version manager, package manager, or container path approved for that repository.

Docker, sessions, and process behavior

Docker service not running

Start Docker only if your project, dev container, preview app, or wrapper workflow requires it, then inspect that project’s logs.

Session stops after logout

Claude Code was started in a normal SSH shell. Use tmux or screen for interactive continuity, or build a secured automation wrapper for reviewed non-interactive execution.

Ports and firewall exposure

Project service port already in use

A dev server, tunnel, preview app, queue worker, or wrapper service may already be bound to the port. Run ss -tulpn and move one service to a different port.

Project service blocked by firewall

Open only the required project-specific port and keep all other ports restricted.

Credentials and provider errors

Missing configuration

Compare the project’s expected configuration with the selected deployment path and add only the required secrets.

Invalid API key or provider error

Rotate the key through the provider, confirm required access, and update the approved server configuration path.

Disk, memory, and scale

Disk space issues

Check df -h, rotate logs, clean caches, prune unused dependencies, and scale storage if logs, build output, dependencies, or repositories have grown.

High memory usage

Reduce parallel builds, test runners, package installs, preview apps, and concurrent coding sessions; scale the VPS if the workload is valid.

When This Setup Is Not Necessary

Local testing is enough

You may not need a VPS if you are only testing Claude Code locally, working from one private machine, reviewing a small repository, or experimenting without persistent SSH access.

Server management may be unnecessary

This setup is not ideal if you do not want to manage Linux updates, SSH access, firewall rules, disk usage, credentials, or repository permissions yourself.

Use a VPS for persistent remote state

Use a VPS when the workspace, repository state, logs, tools, and coding-agent workflow should stay available in a controlled remote environment.

Ready to run Claude Code on an always-on VPS?

Deploy a Claude Code VPS and use this guide as your review checklist while you prepare the setup, secure the server, confirm authentication, and test the workflow.

FAQ

Can I run Claude Code on a VPS?

Yes, if the VPS operating system, hardware, shell, network location, and authentication path meet the current Claude Code requirements. Use this guide as the VPS deployment checklist and keep the Claude Code setup page open for current install details.

Do I need a GPU VPS for Claude Code?

No GPU is required for the remote terminal workflow described here. Claude Code runs as a coding tool in the terminal and uses external Claude access. Only consider GPU hosting if your project separately runs local model inference or GPU workloads.

Does Virtarix provide Claude accounts, API keys, or model access?

No. Virtarix provides self-managed VPS infrastructure. You bring your own Claude access, provider accounts, repositories, credentials, permissions, and project configuration.

What VPS size should I use for Claude Code?

Start with the recommended Virtarix VPS S plan for a practical first server workspace, then scale after measuring CPU, RAM, storage, repository size, package installs, build processes, and concurrent terminal sessions.

Can Claude Code keep running without my local machine?

The VPS can keep the repository, dependencies, logs, terminal multiplexer session, and project state available without your local machine staying online. Claude Code is normally opened in a terminal session, so use tmux or screen for interactive continuity rather than treating Claude Code itself as a generic daemon.

Can I use Docker for this setup?

Yes, when your repository, dev container, preview app, or secured automation wrapper requires Docker. Docker is not required for the normal Claude Code terminal workflow.

Is Virtarix operating Claude Code for me?

No. Virtarix supplies self-managed VPS infrastructure. You install, configure, update, monitor, and secure Claude Code, repositories, project services, and credentials yourself.

Should I follow this guide instead of the official Claude Code documentation?

No. Use this page for VPS planning, security, persistence, and troubleshooting. Use the Claude Code setup documentation for current install commands, authentication, updates, flags, and tool-specific troubleshooting.