code-server runs VS Code on your VPS and accesses it through a browser, enabling development from any device — tablets, Chromebooks, or shared computers. Your development environment lives on the server with full terminal access, extension support, and your exact configuration. This guide covers installing and securing code-server.
Installation
# Install code-server
curl -fsSL https://code-server.dev/install.sh | sh
# Or manually
VERSION=4.91.0
wget https://github.com/coder/code-server/releases/download/v${VERSION}/code-server-${VERSION}-linux-amd64.tar.gz
tar xzf code-server-${VERSION}-linux-amd64.tar.gz
sudo mv code-server-${VERSION}-linux-amd64 /opt/code-server
sudo ln -s /opt/code-server/bin/code-server /usr/local/bin/
Configuration
# ~/.config/code-server/config.yaml
bind-addr: 127.0.0.1:8443
auth: password
password: your-secure-password
cert: false
# Or use hashed password
# Generate: echo -n "password" | npx argon2-cli -e
# hashed-password: "$argon2i$v=19$m=4096,t=3,p=1$..."
Systemd Service
# Enable and start
sudo systemctl enable --now code-server@$USER
# Or create custom service
# /etc/systemd/system/code-server.service
[Unit]
Description=code-server
After=network.target
[Service]
Type=exec
User=developer
ExecStart=/usr/local/bin/code-server --bind-addr 127.0.0.1:8443
Restart=always
[Install]
WantedBy=multi-user.target
Nginx Reverse Proxy with SSL
server {
listen 443 ssl http2;
server_name code.example.com;
ssl_certificate /etc/letsencrypt/live/code.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/code.example.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:8443;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Accept-Encoding gzip;
}
}
Installing Extensions
# Install from command line
code-server --install-extension ms-python.python
code-server --install-extension golang.go
code-server --install-extension rust-lang.rust-analyzer
code-server --install-extension bradlc.vscode-tailwindcss
code-server --install-extension esbenp.prettier-vscode
# Extensions are compatible with VS Code Marketplace
# Some proprietary Microsoft extensions may require Open VSX alternatives
Development Environment Setup
# Install development tools on the VPS
# Node.js
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -
sudo apt install nodejs
# Python
sudo apt install python3 python3-pip python3-venv
# Go
wget https://go.dev/dl/go1.22.5.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.22.5.linux-amd64.tar.gz
echo "export PATH=\$PATH:/usr/local/go/bin" >> ~/.bashrc
# Docker (for container development)
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
# Git configuration
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
Security Hardening
# Use strong authentication
# Option 1: Long random password
openssl rand -base64 32
# Option 2: OAuth with GitHub
# Install oauth2-proxy in front of code-server
# Restrict access by IP (in Nginx)
location / {
allow 203.0.113.0/24; # Your IP range
deny all;
proxy_pass http://127.0.0.1:8443;
}
# Rate limit login attempts
limit_req_zone $binary_remote_addr zone=codeserver:10m rate=5r/m;
location / {
limit_req zone=codeserver burst=10;
proxy_pass http://127.0.0.1:8443;
}
Performance Tips
- VPS specs: Minimum 2 vCPU, 4GB RAM for comfortable use; 4 vCPU, 8GB recommended
- Storage: NVMe SSD essential for responsive file operations
- Latency: Choose a VPS close to your physical location for minimal input lag
- Extensions: Disable unused extensions — they consume RAM even when not active
Summary
code-server transforms any VPS into a full development environment accessible from any browser. Your code, tools, terminal sessions, and environment persist on the server — no local setup needed. Combined with SSL and proper authentication, it provides a secure remote development experience. For developers who work across multiple devices or need consistent environments, code-server on a VPS is a practical alternative to local development setups.