Complete installation and setup guide for Claude Code VM deployment system.
- Ansible 2.9+ installed
- Git for cloning the repository
- Make (usually pre-installed on Linux/macOS)
- SSH client with key-based authentication
- Debian 12+ (Bookworm) or compatible
- SSH access with sudo privileges
- Internet connectivity for package downloads
- 2GB+ RAM recommended
- 10GB+ free disk space
# Clone repository
git clone https://github.com/ksamaschke/claude-code-vm.git
cd claude-code-vm
# First-time setup
make setup
# Edit .env file with your credentials
nano .env
# Test connectivity
make check VM_HOST=your.vm.ip.address TARGET_USER=yourusername
# Deploy everything
make deploy VM_HOST=your.vm.ip.address TARGET_USER=yourusername# Clone repository
git clone https://github.com/ksamaschke/claude-code-vm.git
cd claude-code-vm
# Copy environment template
cp .env.example .env
# Edit configuration
nano .env
nano inventory.yml # If using group deployments
# Validate configuration
ansible-playbook --syntax-check ansible-debian-stack/playbooks/site.yml
# Deploy
ansible-playbook ansible-debian-stack/playbooks/site.yml -e "vm_host=IP target_vm_user=USER"Configure at least one Git provider:
# Required: At least one Git server
GIT_SERVER_GITHUB_URL="https://github.com"
GIT_SERVER_GITHUB_USERNAME="yourusername"
GIT_SERVER_GITHUB_PAT="your_token"
# Optional: Additional Git providers
GIT_SERVER_GITLAB_URL="https://gitlab.com"
GIT_SERVER_GITLAB_USERNAME="yourusername"
GIT_SERVER_GITLAB_PAT="your_token"
# Optional: MCP API keys
BRAVE_API_KEY="your_brave_search_api_key"
TAVILY_API_KEY="your_tavily_api_key"Choose your deployment method:
Single Machine (Default):
# No inventory changes needed
make deploy VM_HOST=192.168.1.100 TARGET_USER=developerMultiple Machines:
Edit inventory.yml to define your server groups:
all:
children:
production:
hosts:
web-01:
ansible_host: 10.0.1.10
target_user: webappChoose your authentication method:
SSH Key (Default):
# Ensure your SSH key is accessible
ssh-add ~/.ssh/id_rsa
make deploy VM_HOST=IP TARGET_USER=userCustom SSH Key:
make deploy VM_HOST=IP TARGET_USER=user TARGET_SSH_KEY=~/.ssh/custom_keyDirect User Connection:
make deploy VM_HOST=IP TARGET_USER=user CONNECT_AS_TARGET=trueSee Authentication Guide for more options.
# Basic connectivity test
make check VM_HOST=your.ip TARGET_USER=username
# Manual SSH test
ssh username@your.ip# Run validation playbook
make validate VM_HOST=your.ip TARGET_USER=username
# Manual verification on target VM
ssh username@your.ip
claude --version
docker --version
node --versionOn the target VM, update your shell environment:
# Log out and back in, OR:
source ~/.bashrcGit credentials are automatically configured, but verify:
git config --list
git clone https://github.com/yourusername/some-repo # Should work without promptingIf you configured MCP API keys:
claude # Start Claude Code
# MCP servers should be automatically loadedScreen sessions are automatically configured:
ssh username@your.ip # Automatically connects to persistent session
# OR manually:
~/scripts/connect-session.shAnsible Connection Failed:
# Test SSH manually
ssh -v username@your.ip
# Check SSH key
ssh-add -lPermission Denied:
# Check sudo access
ssh username@your.ip 'sudo whoami'
# Use password authentication if needed
make deploy VM_HOST=IP TARGET_USER=user USE_SSH_PASSWORD=true SSH_PASSWORD=yourpasswordPackage Installation Failed:
# Check internet connectivity on target
ssh username@your.ip 'ping -c 3 google.com'
# Update package lists
ssh username@your.ip 'sudo apt update'See Troubleshooting Guide for more solutions.
make deploy VM_HOST=IP TARGET_USER=user DEPLOYMENT_DIR=/custom/path/.claude-code-vm# Install only specific components
make deploy-git VM_HOST=IP TARGET_USER=user
make deploy-docker VM_HOST=IP TARGET_USER=user
make deploy-mcp VM_HOST=IP TARGET_USER=user# Use different config files
make deploy VM_HOST=IP TARGET_USER=user ENV_FILE=/path/to/prod.env MCP_FILE=/path/to/prod-mcp.json- Quick Start - Simple deployment
- Configuration - Detailed configuration options
- Authentication - Security and access options
- Components - Individual component configuration