💻

Code-server

Development Tools & IDEs

VS Code ikuyenda mu msakatuli kuti ikule patali kulikonse

Deployment Info

Kutumizidwa kwa anthu: 2-5 min
gulu: Development Tools & IDEs
Thandizo: 24/7

Share this guide

Overview

Code-server is VS Code running in your browser, giving you the power of Microsoft's popular desktop IDE accessible from any device with a web browser. Developed and maintained by Coder, code-server lets you write, debug, and deploy code from anywhere - your tablet, Chromebook, or any computer - while your development environment runs on a powerful remote server.

The magic of code-server is that it provides the exact same VS Code experience you know and love, but accessible through a web browser. All the features are there: IntelliSense code completion, debugging, integrated terminal, Git integration, extensions marketplace with thousands of plugins, and the familiar interface. The only difference is you're accessing it via HTTPS instead of running it locally, but the editing experience feels native and responsive.

Running your development environment on a server offers tremendous advantages. You get consistent, reproducible environments across your entire team, eliminating "works on my machine" problems forever. Powerful server hardware means faster compilation, testing, and builds compared to local laptops. Your code and development state are always available from any device, making it perfect for remote work, switching between devices, or pairing programming with colleagues.

Security and privacy are built into code-server's design. All communication between your browser and the server is encrypted with TLS/SSL. Password authentication and optional OAuth2 integration protect access to your development environment. Your code never leaves the server unless you explicitly push it to version control, making it ideal for working with sensitive codebases or complying with security policies that prohibit code on local machines.

Code-server excels in cloud development workflows. Deploy it on a beefy cloud instance with fast internet, and you get instantaneous code synchronization, fast package installations, and the ability to SSH into production servers from the integrated terminal. The built-in port forwarding lets you preview web applications directly in your browser, with automatic HTTPS and authentication. You can even work on large codebases without worrying about local disk space or memory constraints.

The extension ecosystem is vast - most VS Code extensions work seamlessly with code-server. Language support, linters, formatters, themes, and productivity tools are all available. You can sync your settings and extensions across instances using the built-in Settings Sync or by mounting your VS Code configuration directory. Some extensions may require minor modifications, but the core marketplace offers thousands of ready-to-use extensions.

Whether you're a freelance developer working from coffee shops, a remote team needing consistent development environments, an educator teaching coding online, or an enterprise enforcing zero-trust security policies, code-server provides professional-grade development tools accessible from anywhere without compromising on features or performance.

Key Features

Full VS Code in Browser

Complete VS Code experience with all features - IntelliSense, debugging, extensions, themes, and integrated terminal

Work from Anywhere

Access your development environment from any device with a browser - tablets, Chromebooks, or any computer

Powerful Remote Development

Leverage server hardware for compilation, testing, and builds while editing code responsively in browser

Extensive Extension Support

Access thousands of VS Code extensions including language servers, linters, formatters, and productivity tools

Secure by Default

TLS encryption, password authentication, optional OAuth2, and code stays on server for compliance

Built-in Port Forwarding

Preview web applications with automatic HTTPS and authentication tunneling through code-server

Kugwiritsa ntchito Cases

• **Remote Development Teams**: Consistent development environments for distributed teams with instant setup
• **Cloud-Native Development**: Build and test cloud applications directly on cloud servers close to production
• **Education & Training**: Teach coding with pre-configured environments accessible via browser link
• **Contract & Consulting Work**: Access client codebases securely without downloading to personal devices
• **Mobile Development**: Code on iPad or tablet with full IDE capabilities for travel or commute coding
• **High-Performance Computing**: Leverage powerful cloud instances for large codebases, AI/ML, or compilation-heavy projects
• **Zero Trust Security**: Comply with policies requiring code to remain on corporate infrastructure

Installation Guide

**Installation on Ubuntu 22.04 LTS:**

**1. Install via Install Script (Recommended):**
```bash
curl -fsSL https://code-server.dev/install.sh | sh
```

**2. Or Install Manually:**
```bash
# Download latest release
VERSION=$(curl -s https://api.github.com/repos/coder/code-server/releases/latest | grep -oP '"tag_name": "v\K[^"]+')
wget https://github.com/coder/code-server/releases/download/v${VERSION}/code-server_${VERSION}_amd64.deb

# Install package
sudo dpkg -i code-server_${VERSION}_amd64.deb
```

**3. Configure code-server:**
```bash
# Edit config file
nano ~/.config/code-server/config.yaml
```

Set configuration:
```yaml
bind-addr: 0.0.0.0:8080
auth: password
password: your_secure_password_here
cert: false # We'll use reverse proxy for SSL
```

**4. Create Systemd Service:**
```bash
sudo systemctl enable --now code-server@$USER
sudo systemctl status code-server@$USER
```

**5. Configure Nginx Reverse Proxy:**
```bash
sudo apt install nginx -y
sudo nano /etc/nginx/sites-available/code-server
```

Add configuration:
```nginx
server {
listen 80;
server_name code.yourdomain.com;

location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```

Enable site:
```bash
sudo ln -s /etc/nginx/sites-available/code-server /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
```

**6. Get SSL Certificate:**
```bash
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d code.yourdomain.com
```

**7. Access code-server:**
Open browser to `https://code.yourdomain.com`
- Login with password from config.yaml

**8. Install Extensions:**
```bash
# Via command line
code-server --install-extension ms-python.python
code-server --install-extension esbenp.prettier-vscode

# Or use Extensions panel in UI
```

**9. Configure Firewall:**
```bash
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 22/tcp # SSH
```

**10. Optional - Docker Installation:**
```bash
# Run code-server in Docker
docker run -it --name code-server -p 127.0.0.1:8080:8080 \
-v "$HOME/.config:/home/coder/.config" \
-v "$HOME/projects:/home/coder/projects" \
-u "$(id -u):$(id -g)" \
-e "DOCKER_USER=$USER" \
codercom/code-server:latest
```

Configuration Tips

**Essential Configuration:**

1. **Config File (~/.config/code-server/config.yaml):**
```yaml
bind-addr: 0.0.0.0:8080
auth: password
password: secure_password_here
cert: false
proxy-domain: code.yourdomain.com
```

2. **Authentication Methods:**
```bash
# Password authentication (default)
auth: password
password: your_password

# Disable authentication (dangerous, use with reverse proxy auth)
auth: none

# Use hashed password
hashed-password: "$argon2i$v=19$m=4096,t=3,p=1$..."
```

3. **Environment Variables:**
```bash
# Set password via env
export PASSWORD="your_password"

# Disable telemetry
export TELEMETRY_LEVEL="off"

# Custom extensions directory
export EXTENSIONS_GALLERY='{"serviceUrl": "https://open-vsx.org/vscode/gallery"}'
```

4. **Port Forwarding Configuration:**
```bash
# Forward local dev server to public URL
# In code-server terminal:
npm run dev # Starts on localhost:3000

# code-server automatically detects and offers to forward
# Access at: https://code.yourdomain.com/proxy/3000/
```

5. **Extensions Configuration:**
```bash
# Install from marketplace
code-server --install-extension publisher.extension-name

# Install from VSIX
code-server --install-extension /path/to/extension.vsix

# List installed extensions
code-server --list-extensions

# Uninstall extension
code-server --uninstall-extension publisher.extension-name
```

6. **Settings Sync:**
```json
// settings.json location: ~/.local/share/code-server/User/settings.json
{
"workbench.colorTheme": "Default Dark+",
"editor.fontSize": 14,
"editor.formatOnSave": true,
"files.autoSave": "afterDelay",
"terminal.integrated.shell.linux": "/bin/bash"
}
```

7. **Multi-User Setup:**
```bash
# Create service for user1
sudo systemctl enable --now code-server@user1

# Create service for user2
sudo systemctl enable --now code-server@user2

# Each user gets own config in their home directory
# ~/.config/code-server/config.yaml
```

8. **Security Hardening:**
```bash
# Limit network access
bind-addr: 127.0.0.1:8080 # Only localhost

# Use strong password (20+ chars)
password: $(openssl rand -base64 32)

# Enable HTTPS on reverse proxy
# Use fail2ban for brute force protection
sudo apt install fail2ban

# Configure fail2ban for code-server
sudo nano /etc/fail2ban/jail.local
```

Add:
```ini
[nginx-code-server]
enabled = true
port = 80,443
filter = nginx-code-server
logpath = /var/log/nginx/access.log
maxretry = 3
bantime = 3600
```

9. **Performance Tuning:**
```yaml
# Increase file watcher limit
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

# Disable telemetry
export TELEMETRY_LEVEL=off

# Use faster protocol
# In settings.json:
{
"terminal.integrated.rendererType": "dom"
}
```

10. **Backup and Migration:**
```bash
# Backup user data
tar -czf code-server-backup.tar.gz \
~/.local/share/code-server \
~/.config/code-server

# Restore on new server
tar -xzf code-server-backup.tar.gz -C ~
```

**Best Practices:**
- Use reverse proxy (Nginx/Caddy) for SSL termination
- Enable automatic HTTPS with Let's Encrypt
- Set strong passwords (20+ characters)
- Regularly update code-server: `curl -fsSL https://code-server.dev/install.sh | sh`
- Mount projects directory separately for easy backup
- Use systemd for automatic restart on failure
- Configure rate limiting on reverse proxy
- Enable fail2ban for brute force protection
- Use OAuth2 proxy for SSO integration
- Separate dev/staging/prod instances per user/team
- Monitor logs: `journalctl -u code-server@$USER -f`
- Set up automated backups of user data and config

Voterani Nkhaniyi

-
Loading...

Kodi Mwakonzeka Kutumiza Fomu Yanu Yofunsira? ?

Get started in minutes with our simple VPS deployment process

Palibe khadi la ngongole lofunikira kuti mulembetse • Ikani mumphindi 2-5