To run Claude Code on a VPS, rent an Ubuntu server, install Claude Code with Anthropic’s installer, start it inside a tmux session so it keeps running when you disconnect, and connect over SSH or Mosh from any device. This guide walks through each step, in a normal setup and inside Docker. The last section covers the other half: getting the app Claude Code builds onto a server your users can reach.
Claude Code supports Ubuntu 20.04 and newer, per its setup docs.
The story behind this guide
For the past three weeks, I’ve been asking users on X (Twitter) if anyone was successfully running Claude Code on a VPS. The responses were sparse, with only one or two people providing limited feedback. Then yesterday, everything changed.
I stumbled upon a post from Pieter Levels (@levelsio), the internet guru of building in public. @levelsio was talking about installing Claude Code on a server, accessing it remotely, and running it infinitely from any device. That’s when the lightbulb went off.
Inspired by his approach, I set out to write down how anyone can build their own VibeCoding server, anywhere they want.
🤔 What is VibeCoding?
VibeCoding represents a paradigm shift in how we write software. Instead of typing out every line of code, you have natural conversations with Claude AI, describing what you want to achieve. Claude then acts as your eager junior developer, writing the actual implementation while you focus on architecture and business logic.
You describe the “vibe” of what you want, and Claude translates that into working code.
You spend your time on architecture and review, and the agent handles more of the boilerplate. Review what it writes, as you would a junior developer’s pull request.
🤖 Enter Claude Code: Your AI Development Partner
Claude Code is Anthropic’s command-line tool that brings Claude AI directly into your development workflow. It’s a full-fledged development partner, not another code completion tool. It can:
- Understand entire codebases: Claude reads and comprehends your project structure, dependencies, and conventions
- Make coordinated changes: Edit multiple files simultaneously while maintaining consistency
- Write and run tests: Create comprehensive test suites and implement code to pass them
- Handle DevOps tasks: Configure servers, manage deployments, and automate infrastructure
💪 Why Run Claude Code on a VPS?
Claude Code works on your local machine, but deploying it on a Virtual Private Server (VPS), your VibeServer, adds things you don’t get locally:
1. Always-On Development Environment
Your VibeServer never sleeps. Queue up tasks before bed and wake up to completed features. Run long refactoring jobs without tying up your laptop. Your AI assistant is always ready to code, 24/7.
2. Team Collaboration at Scale
Share a single Claude Code instance across your team. Standardize your VibeCoding workflows, share context through CLAUDE.md files, and ensure everyone benefits from the same AI-powered productivity boost.
3. Resource Optimization
VPS environments provide dedicated resources for Claude operations. No more laptop fan noise during intensive coding sessions. Scale up resources instantly when tackling large codebases or complex tasks.
4. Remote Development Freedom
Access your VibeServer from literally ANY device with Terminus:
- Mobile phones - Code while commuting or waiting in line
- Tablets - Full development power in a portable form factor
- Any computer - No setup needed, just SSH in
- Smart TVs - Yes, even your TV can become a development machine!
With Mosh maintaining your connection through network changes and Terminus providing mobile-optimized access, you have a true “code from anywhere” setup. No dropped connections, no barriers between you and your development environment.
🛠️ Setting Up Your VibeServer
You can run Claude Code in two ways: directly on your VPS (Normal Mode) or inside Docker for better isolation. Choose the method that works best for you.
📋 Step 1: Choose Your VPS Provider
Select a provider that offers:
- 🔐 SSH access - Essential for remote connection and management
- 💾 Adequate RAM - 8GB+ recommended for larger projects
- ⚡ SSD storage - Fast file operations for better performance
- 🐳 Docker support - If you plan to use Docker mode for isolation
Popular choices include:
- Amazon Lightsail - A simple VPS with fixed monthly pricing
- AWS EC2 - More advanced but powerful option
- Vultr VPS - High-performance cloud compute instances
- Google Compute Engine - Excellent for scaling
🚀 Normal Mode Setup
Step 1: Initial Server Setup
# Update system packages
sudo apt update && sudo apt upgrade -y
# Install Node.js (required for npm)
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejs
# Install tmux for persistent sessions
sudo apt install -y tmux
Step 2: Install Claude Code
# Install Claude Code with Anthropic's installer (see code.claude.com/docs/en/setup)
curl -fsSL https://claude.ai/install.sh | bash
# Verify installation
claude --version
Step 3: Run Claude Code in tmux
# Create or attach to tmux session named 'vibeserver'
tmux attach -As vibeserver
# Run Claude Code
claude
# Detach from tmux (Ctrl+b, then d) to keep it running
# Reattach anytime with: tmux attach -As vibeserver
🐳 Docker Mode Setup
For better isolation and easier management, you can run Claude Code inside Docker:
Step 1: Install Docker
# Install Docker
curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker $USER
# Log out and back in for group changes to take effect
exit
# Then SSH back in
Step 2: Create Docker Container
# Create a Dockerfile
cat > Dockerfile << EOF
FROM node:lts-alpine
WORKDIR /workspace
RUN curl -fsSL https://claude.ai/install.sh | bash
# Install additional development tools
RUN apk add --no-cache git python3 make g++ bash
VOLUME ["/workspace"]
CMD ["claude"]
EOF
# Build the Docker image
docker build -t vibeserver .
# Run Claude Code in Docker
docker run -it --name claude-session \
-v $(pwd):/workspace \
-p 3000:3000 \
vibeserver
Benefits of Docker mode:
- Isolated environment - No conflicts with system packages
- Easy cleanup - Just remove the container
- Consistent setup - Same environment every time
- Multiple projects - Run different containers for different projects
🔐 Configure Claude Code (Both Modes)
The configuration is the same for Normal and Docker mode:
# For Normal Mode:
claude
# For Docker Mode (if not already in the container):
docker exec -it claude-session claude
Once in the Claude session, run the login command:
/login
This will open a browser window for authentication and connect Claude Code to your Anthropic account.
📁 Set Up Your Project
# Clone your project
git clone https://github.com/yourusername/your-project.git
cd your-project
# Start Claude Code
claude
Once in your Claude session, you can run the /init command to generate a CLAUDE.md file for your project:
/init
This command analyzes your project structure and creates a CLAUDE.md file that serves as context for Claude about your project’s conventions, dependencies, and architecture. You can also manually create or edit this file to provide specific instructions and context for your project.
📱 Access Your VibeServer from Anywhere
Using Mosh with tmux for Mobile Access
The perfect mobile setup combines Mosh (for resilient connections) with tmux (for persistent sessions). Here’s how to set it up:
Prerequisites
# Install on your VPS
sudo apt install mosh tmux
# Ensure UTF-8 encoding
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# Open UDP ports 60000-61000 for Mosh (if using firewall)
sudo ufw allow 60000:61000/udp
Basic Workflow
-
Connect to your server with Mosh:
mosh your-username@your-server -
Start or attach to your tmux session:
# This command will attach if session exists, or create if it doesn't tmux attach -As vibeserver -
Run Claude Code:
claude /login # First time only /init # To initialize your project -
Detach when done (Ctrl+b, then d) Your Claude session keeps running!
Advanced: Direct Connection
Connect and attach to tmux in one command:
mosh your-username@your-server -- tmux attach -As vibeserver
Mobile Access with Terminus
For the ultimate mobile experience:
-
Install Terminus on your mobile device (iOS/Android)
-
Add your VPS with these settings:
- Protocol: Mosh
- Host: your-server-ip
- Username: your-username
- Authentication: SSH key (recommended)
-
Create a snippet in Terminus for quick access:
tmux attach -As vibeserver
Why This Setup is Perfect for Mobile
- Network Resilience: Mosh handles connection drops, network switches (WiFi↔️Cellular), and IP changes
- Low Latency: Local echo makes typing responsive even on slow connections
- Session Persistence: tmux keeps Claude running even when you’re disconnected
- Mobile Optimized: Works great on small screens with touch keyboards
Real-World Scenarios
This setup shines when:
- Commuting: Code on the subway, through tunnels, with spotty signal
- Traveling: Switch between hotel WiFi, mobile hotspots, and airport networks
- Coffee Shops: Handle flaky public WiFi without losing work
- Anywhere: Your phone becomes a full development machine
Quick Tips
- Use
tmux lsto list all sessions - Create multiple sessions for different projects
- Set up tmux shortcuts for faster navigation
- Enable Mosh prediction for even better responsiveness
With Mosh + tmux + Terminus, you have a true “code from anywhere” setup that’s resilient, responsive, and ready whenever inspiration strikes!
⚡ Performance Optimization
1. Context Management
Claude Code automatically manages context for optimal performance. The CLAUDE.md file in your project root serves as persistent context that Claude references for every task.
2. Resource Monitoring
# Monitor Claude Code resource usage
htop
docker stats
3. Caching Strategies
Implement caching for frequently accessed data to reduce API calls and improve response times.
💡 Real-World Use Cases
Startup Scenario: Rapid MVP Development
A startup used VibeServer to build their MVP in 2 weeks instead of 2 months:
- Described features in natural language
- Claude Code implemented full-stack application
- Automated testing ensured quality
- Deployed directly from VibeServer
Enterprise Scenario: Legacy Code Modernization
An enterprise team modernized a 10-year-old codebase:
- Claude Code analyzed millions of lines of code
- Suggested and implemented refactoring strategies
- Maintained backward compatibility
- Reduced technical debt by 60%
Agency Scenario: Multi-Project Management
A development agency manages 50+ client projects:
- Separate VibeServer instances for each client
- Standardized VibeCoding workflows
- Automated maintenance tasks
🌟 What’s Next for VibeCoding
As Claude Code evolves, we’re seeing emerging patterns:
1. Email-Driven Development
Claude Code Remote allows controlling your VibeServer via email, enabling asynchronous development workflows.
2. Multi-Agent Collaboration
Multiple Claude instances working together on different aspects of a project, coordinated through a central VibeServer.
3. Self-Improving Codebases
Projects that use Claude Code to continuously refactor and optimize themselves based on usage patterns.
How do I deploy what Claude Code builds?
A VPS that runs Claude Code is a development box. To put the app it writes in front of users, deploy it to a server. CloudPloy lets Claude Code do that itself over MCP:
- Connect a server: AWS EC2 in your own account, or any fresh Ubuntu or Debian server over SSH.
- Add the MCP server:
claude mcp add --transport http cloudploy https://brain.cloudploy.com/mcp, and sign in when the browser opens. - Ask Claude Code to create the app from your repo and deploy it. Apps build with Nixpacks, get automatic SSL and switch releases with zero downtime.
The full walkthrough is in How to deploy from Claude Code with an MCP server. If you are still choosing a host, read where to host a vibe-coded app. There is a Free plan, and paid plans are $9.99 to $39 a month; see pricing.
FAQ
Can I run Claude Code on a VPS?
Yes. Install it on an Ubuntu server, start it in tmux, and connect over SSH. Anthropic lists Ubuntu 20.04 and newer as supported.
How do I keep Claude Code running after I disconnect?
Run it inside a tmux session. Detach with Ctrl+b, then d, and reattach later with tmux attach -As vibeserver.
Is it safe to give Claude Code a server?
Treat it like a developer with shell access. Use a dedicated server, keep production secrets off it, and consider the Docker setup above for isolation.
Can Claude Code deploy the app it builds?
Yes, through an MCP server such as CloudPloy’s. It connects over a browser sign-in, so you never paste a token into the chat.
🎉 Conclusion: Embrace the Vibe
VibeCoding with Claude Code on a VPS does more than speed up how you write code. It changes how you approach software development. By describing what we want to build rather than how to build it, we free ourselves to think at a higher level, solve bigger problems, and create better software.
Your VibeServer is more than infrastructure. It’s an always-on development partner that turns ideas into working code. If you’re a solo developer who wants an always-on agent, or a team standardizing on AI-assisted development, running Claude Code on a VPS gets you there.
Ready to start VibeCoding? Set up your VibeServer today and experience the joy of development where the only limit is your imagination. And when you’re ready to deploy those Claude-crafted applications, see the deploy section above.
Welcome to the age of VibeCoding. Welcome to your VibeServer. Welcome to development that finally speaks your language.
Updated November 23, 2026.