Self-host guide

How to Self-Host code-server on a VPS

Install code-server on Ubuntu 24.04 with Coder's install script, reach it over an SSH tunnel or Caddy HTTPS, and keep its settings and extensions backed up.

code-server, from Coder, runs Visual Studio Code on a server and serves it to your browser. The editor, terminal, Git and extensions all work against the server's files, so a laptop, tablet or borrowed machine becomes a front end to a more capable remote machine. This guide installs it by hand on Ubuntu 24.04 with Coder's install script, runs it as an ordinary user, and covers both ways the project recommends to reach it safely: an SSH tunnel, or Caddy with a Let's Encrypt certificate.

Prefer one click? Deploy code-server from the VeloxaHost marketplace and skip the manual steps; this guide is for when you want to run every command yourself.

What you need

  • A VeloxaHost server with the Ubuntu 24.04 LTS image. You get root, over SSH or in the browser terminal on the server's page.
  • One way in. Coder's guide warns never to expose code-server to the internet without authentication and encryption, because anyone who gets in has a terminal on your server. Pick one:
    • SSH tunnel. The project's preferred option, and it needs nothing extra. Every server gets a block of ports on a shared IPv4 address, and the first port forwards to SSH.
    • HTTPS on a domain. Needed for an iPad or any device without an SSH client. Caddy gets its certificate over ports 80 and 443, which the shared IPv4 address does not offer. A dedicated IPv4 is a paid add-on (the console shows the current price): choose it as "Network access" on the create page, or take one from the IP addresses page and attach it. If none is free in the region, the request is refused.

Coder's requirements page asks for at least 1 GB of RAM and 2 CPU cores. Language servers, compilers and test runs use far more than the editor, so size for your builds. A Veloxa 2 (2 vCPU, 4 GB RAM, 80 GB disk) at $15 a month, billed at $0.03 an hour and capped at the monthly price, is a sound start.

Install code-server

  1. Preview what Coder's install script will do, then run it. On Ubuntu it installs the latest .deb package.

    curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
    curl -fsSL https://code-server.dev/install.sh | sh
    
  2. Create an ordinary user to own your projects, so the editor's terminal does not run as root. This command is ours, not Coder's.

    adduser dev
    
  3. Start code-server for that user, as the install page shows for Debian and Ubuntu. The first start writes /home/dev/.config/code-server/config.yaml with a random password.

    sudo systemctl enable --now code-server@dev
    
  4. Check the config file. The defaults are what you want: listen on 127.0.0.1:8080 only, password login, no TLS of its own.

    bind-addr: 127.0.0.1:8080
    auth: password
    password: mew...22 # Randomly generated for each config.yaml
    cert: false
    

Variant A: SSH tunnel. On your own computer, forward local port 8080 to the server through the first port of your block, then open http://127.0.0.1:8080. The -N flag skips the remote shell.

ssh -N -p 20000 -L 8080:127.0.0.1:8080 root@203.0.113.10

This is the command from Coder's guide with -p 20000 added, since SSH on VeloxaHost answers on the first port of your block rather than 22. Coder's guide also turns the password off for tunnel-only use. Keep it on if anyone else has a login on the server, because they can reach 127.0.0.1:8080 too.

Variant B: HTTPS with Caddy. Make the server answer on its dedicated IPv4: add the address to the interface (check the name with ip addr), and to the network configuration so it survives a reboot. Point an A record such as code.example.com at it. IPv6 is not available in US East yet, so skip the AAAA record there.

ip addr add 198.51.100.5/32 dev eth0

Install Caddy from its apt repository, as in Caddy's install docs:

sudo apt install --yes debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo chmod o+r /usr/share/keyrings/caddy-stable-archive-keyring.gpg
sudo chmod o+r /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy

Replace /etc/caddy/Caddyfile with code-server's example, using your domain, and reload Caddy:

code.example.com {
  reverse_proxy 127.0.0.1:8080
}
sudo systemctl reload caddy

Caddy passes the WebSocket connections code-server needs and renews the certificate on its own.

First login

Read the password and sign in at https://code.example.com or, over the tunnel, http://127.0.0.1:8080.

grep password /home/dev/.config/code-server/config.yaml

Open a folder in the user's home, then install extensions from the Extensions sidebar. code-server uses the Open VSX registry: Microsoft's marketplace terms limit it to Microsoft's own products, so a few Microsoft-only extensions are missing. A VSIX file you download yourself installs with Extensions: Install from VSIX.

Some features, such as web views, rely on service workers, which browsers only allow in a secure context. They work over HTTPS and over 127.0.0.1, but not over a plain IP address.

Secure it

In the console, go to Firewalls, New Firewall, Add Rule. For Variant B, allow TCP 80 and 443 from 0.0.0.0/0. Allow TCP 22 only from YOUR.IP/32, then attach the firewall on the server's page. Until one is attached, all traffic is allowed.

From code-server's docs:

  • Keep bind-addr on 127.0.0.1:8080, so the only ways in are the tunnel and Caddy. Never forward a port of your block straight to 8080: that would be plain HTTP with a terminal behind it.
  • Use a long password. code-server allows two login attempts a minute plus twelve more an hour.
  • Store the password hashed: set hashed-password instead of password in config.yaml, with an argon2 hash in quotes. The FAQ generates one with npx argon2-cli, which needs Node.js on the machine where you run it.
  • Add disable-telemetry: true to config.yaml if you want no usage data sent. Every key in the file maps to a command-line flag.

After any change to config.yaml, restart the service:

sudo systemctl restart code-server@dev

Back it up

code-server keeps its config in ~/.config/code-server and settings, keybindings and extensions in ~/.local/share/code-server. Your projects live wherever you cloned them, usually in the same home directory. Push code to a Git remote as you work; that is your first backup.

For the rest, an archive of the user's home directory covers everything. This command is ours:

sudo tar czf /root/dev-home-$(date +%F).tar.gz -C /home dev

On VeloxaHost, snapshots are instant and free (5 on Starter, 30 on Pay as you go): server page, Snapshots, name, Create. Restoring overwrites the current state. Automatic snapshots run every hour, 6 hours, 12 hours, daily or weekly, kept for 1, 3, 7, 14 or 30 days. The Backups page creates, downloads and restores server backups (as a new server), on a schedule of every 6 hours, 12 hours, daily or weekly, keeping 1 to 10. Download one now and then for an off-site copy.

Update it

Coder's upgrade page says to install the new version over the old one. User data is in ~/.local/share/code-server, so it stays. Take a snapshot, run the script again and restart:

curl -fsSL https://code-server.dev/install.sh | sh
sudo systemctl restart code-server@dev

The latest release was 4.141.0 when checked. To stay on a version you have tested, the script takes --version:

curl -fsSL https://code-server.dev/install.sh | sh -s -- --version=4.141.0

Troubleshooting

The page loads but the editor never connects. A proxy in front is dropping WebSocket upgrades. Caddy passes them by default; for nginx, use the Upgrade and Connection headers from code-server's guide.

The password is rejected after you changed it. code-server reads config.yaml only at start. Restart code-server@dev.

Web views or the Markdown preview stay blank. You are on an insecure origin. Use the HTTPS domain or the tunnel to 127.0.0.1.

Something else misbehaves. Coder's FAQ asks for the newest files in ~/.local/share/code-server/coder-logs, plus the browser console and network tab. The service log is in journalctl -u code-server@dev; that command is ours.

FAQ

What license is code-server under?

code-server is released under the MIT license by Coder Technologies. It is built from the MIT-licensed VS Code source code, not from Microsoft's branded Visual Studio Code product.

Can I use extensions from Microsoft's marketplace?

No. Microsoft's terms allow its marketplace only with Microsoft's own Visual Studio products, so code-server installs extensions from Open VSX instead. Most popular extensions are published there, and you can install others from a VSIX file.

Do I need a dedicated IPv4 address?

Only for HTTPS on your own domain, because Caddy needs ports 80 and 443 and the shared IPv4 address only offers a block of forwarded ports. The SSH tunnel through the first port of your block needs no extra address, and Coder recommends it.

Can I use code-server on an iPad?

Yes, over HTTPS with a real certificate, which is Variant B in this guide. Coder's docs note that self-signed certificates do not work on an iPad, and the SSH tunnel needs an SSH client the iPad may not have.

Which VeloxaHost size fits code-server?

Coder asks for at least 2 CPU cores and 1 GB of RAM. A Veloxa 2 (2 vCPU, 4 GB RAM, 80 GB disk) at $15 a month, billed at $0.03 an hour and capped at the monthly price, leaves room for language servers and builds. For large compiles, a Veloxa 4 (4 vCPU, 8 GB RAM, 160 GB disk) at $30 a month, billed at $0.05 an hour and capped at the monthly price, gives more headroom.

Commands and settings checked on 2026-10-19 against the official documentation: coder.com, github.com, caddyserver.com. Software changes; if a step no longer matches, the vendor's docs win.

Ready to deploy?

Start a free trial, or compare plans to match your team's scale.