Build a 24/7 AI Coding Workstation on VPS: Complete Cursor + code-server Setup Guide

ℹ️

Disclosure: This article may contain affiliate links. If you purchase through these links, we may earn a small commission at no additional cost to you. All reviews are independently written and opinions remain unbiased.Learn more →

📢Limited Offer — Vultr Free Credit Up to $300! Claim →

💡 Summary

  • AI programming tools have transformed modern development workflows, yet many people do not realize a local development environment is unnecessary.
  • A $10 to $15 VPS paired with Cursor remote SSH or code-server works for far more scenarios than most expect, and outperforms local setups in several key aspects.
  • This article walks through the complete setup process from scratch to ready-to-use deployment。.
💡
💡

Hostinger — Editor's Pick

Get the best price through our exclusive link and support our reviews.

Explore Hostinger

I recently migrated part of my development work to a VPS. It started as a temporary workaround during a business trip when I only had a thin laptop with limited performance—but after using it for a while, I found it genuinely more convenient in several ways. An AI agent runs on it 24/7 without worrying about the local machine sleeping or losing power. Builds and tests don't consume local resources, and the laptop fan stays quiet.

Cloud development isn't a universal solution. Scenarios requiring a local GPU or extreme latency sensitivity are better served locally. But for many everyday coding tasks, a $15/month VPS is worth serious consideration.


Is this setup right for you?

Good fit: you primarily write code in editors like Cursor, VS Code, or NeoVim; your projects run in Linux/Docker environments; you need a server to run AI agents or scheduled tasks continuously; you regularly switch between different devices.

Not a good fit: you need a local GPU for model training or inference; iOS development requires Xcode; you're highly sensitive to code completion latency (network delay will affect the experience); you have no Linux background at all.


Server selection: what configuration is sufficient

Minimum and recommended specs

Use caseCPURAMStorage
Lightweight coding + testing2 cores4GB40GB NVMe
Primary development environment4 cores8GB80GB NVMe
Multi-project + Docker4 cores16GB100GB NVMe

A 4-core 8GB configuration handles multiple Docker containers simultaneously, compiles medium-sized projects, and runs AI agents—sufficient for most individual developers.

Node selection has an outsized impact on experience

Latency is the most important hidden factor in this setup. When writing code over SSH, delays above 100ms produce noticeable input lag; above 200ms it becomes effectively unusable.

Choose a node close to your physical location: users in China should select Hong Kong, Singapore, or Japan; US users should choose the West Coast; European users should select Germany or the Netherlands. Test evening peak latency to your target node before purchasing—daytime figures don't reflect real conditions.

Hetzner offers the best value on European nodes at around €8–10/month for 4-core 8GB. Vultr and DigitalOcean provide broad global coverage with flexible hourly billing. DMIT offers CN2 GIA routing optimization for users in China with stable low latency.


Complete setup walkthrough

Step 1: Basic security configuration

After purchasing the VPS, complete security configuration before installing the development environment.

# Connect via SSH
ssh root@your_server_IP

# Update system
apt update && apt upgrade -y

# Create a regular user (avoid running as root long-term)
adduser dev
usermod -aG sudo dev

# Switch to new user
su - dev

Configure SSH key login (run locally):

# Generate key pair locally
ssh-keygen -t ed25519 -C "vps-dev"

# Upload public key to server
ssh-copy-id dev@your_server_IP

After confirming key login works, disable password authentication:

sudo nano /etc/ssh/sshd_config
# Find and modify:
# PasswordAuthentication no
# Port 2222  (change from default)
sudo systemctl restart sshd

Configure the firewall:

sudo ufw allow 2222/tcp   # Your new SSH port
sudo ufw allow 8080/tcp   # code-server port (used later)
sudo ufw enable

Step 2: Install the development environment

# Install essential tools
sudo apt install -y git curl wget build-essential

# Install Docker
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker dev
newgrp docker

# Verify Docker works
docker run hello-world

Install Node.js if needed:

curl -fsSL https://deb.nodesource.com/setup_22.x | sudo bash -
sudo apt-get install -y nodejs

Install Python development environment:

sudo apt install -y python3 python3-pip python3-venv

Step 3: Deploy code-server (VS Code in the browser)

code-server runs a full VS Code instance accessible from any browser without installing anything locally:

curl -fsSL https://code-server.dev/install.sh | sh

Edit ~/.config/code-server/config.yaml:

bind-addr: 127.0.0.1:8080
auth: password
password: your_secure_password
cert: false

Enable auto-start on boot:

sudo systemctl enable --now code-server@dev

Set up Nginx with HTTPS for secure access:

sudo apt install nginx certbot python3-certbot-nginx -y

Nginx configuration:

server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_pass http://localhost:8080;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection upgrade;
        proxy_set_header Accept-Encoding gzip;
    }
}

Apply for an SSL certificate:

sudo certbot --nginx -d your-domain.com

Once configured, open https://your-domain.com in any browser, enter your password, and you're in a full VS Code environment.

Step 4: Connect with Cursor (recommended approach)

If you use Cursor rather than code-server, connecting via Remote SSH delivers a smoother experience. Add to ~/.ssh/config locally:

Host my-vps
    HostName your_server_IP
    User dev
    Port 2222
    IdentityFile ~/.ssh/id_ed25519

In Cursor, press Cmd+Shift+P, search for "Remote-SSH: Connect to Host", and select my-vps. Cursor automatically installs the necessary components on the server and opens a session running entirely in the server environment.


Keeping AI agents running continuously

This is the biggest advantage of cloud development over local: programs keep running regardless of whether your computer is online. Use systemd to manage long-running agent services:

sudo nano /etc/systemd/system/my-agent.service
[Unit]
Description=My AI Agent
After=network.target

[Service]
Type=simple
User=dev
WorkingDirectory=/home/dev/my-agent
ExecStart=/home/dev/.venv/bin/python agent.py
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable my-agent
sudo systemctl start my-agent

Use journalctl -u my-agent -f to follow the agent's logs in real time.


Troubleshooting common issues

Input lag from high latency

First confirm actual latency with ping your_server_IP. If the latency itself is low but SSH still feels sluggish, add these options to ~/.ssh/config:

Host my-vps
    ...
    ServerAliveInterval 60
    TCPKeepAlive yes
    Compression yes

Compression yes helps on slower connections but isn't necessary on fast local networks.

Insufficient memory

free -h
# Check which processes use the most memory
ps aux --sort=-%mem | head -10

If memory is consistently near the ceiling, add swap as a stopgap before upgrading:

sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

code-server inaccessible

Check in sequence: whether code-server is running (systemctl status code-server@dev), whether Nginx is healthy (systemctl status nginx), and whether the firewall ports are open (ufw status).


The cost calculation

A 4-core 8GB VPS runs about $20/month on Vultr or around $10/month on Hostinger. Compared to the monthly amortized cost of a MacBook Pro, the difference is significant.

This doesn't mean a VPS replaces your local machine entirely—it means a substantial portion of development work can move to the cloud, with the local machine handling only lightweight tasks and display. An entry-level laptop becomes sufficient for the rest.

If your primary work is web development, backend services, or AI application development, this setup is worth a serious trial.

🚀

Ready for Hostinger? Now is the perfect time

Use our exclusive link for the best price — and help support our content.

❓ 常见问题(FAQ)

← Previous
2026: Build Your Own AI or Stick with Subscriptions? GPU & High-Memory VPS Buying Guide
Next →
DMIT Latest Restock: US West & Japan Nodes with Optimized China Mainland Routes (Quick Overview)

🏷️ Related Keywords

💬 Comments

150 characters left

No comments yet. Be the first!

← Back to Articles

VPS Rankings focuses on VPS selection, bringing together provider reviews, rankings, practical tutorials, performance benchmarks, and deal roundups. Complete your entire journey — from research and comparison to purchase — in one place. Whether you need budget web hosting, overseas cloud servers, or want to compare specs, routing, and pricing across providers, we make the decision easier. We also maintain long-term coverage of CN2 GIA, low-latency Asia routes, and other optimized solutions tailored for China-facing networks and cross-border businesses, and continuously update VPS recommendations, hands-on guides, and deal collections to help you make faster, more informed choices.