On this page
- Why run code-server on a VPS?
- How do you install code-server?
- How do you run it as a service and set the password?
- How do you publish code-server over HTTPS?
- How do you add a second layer of protection?
- How do you install extensions and tools?
- How do you update code-server?
- What are common code-server problems?
- Questions
Why run code-server on a VPS?
code-server packages the open source core of VS Code as a web app. Your files, compilers and terminal sessions stay on the server, and any device with a browser becomes the editor: a tablet, a borrowed laptop or a thin client. Builds run on server CPUs and the editor keeps state between devices.
Because whoever logs in gets a shell as your user, treat it like SSH access. Run it under a normal sudo user such as deploy (see create a sudo user), never as root, and protect it with HTTPS plus a long password or a login gateway.
A plan with 2 GB of memory handles editing and light builds; language servers for large TypeScript, Java or Rust projects push that toward 4 GB or more.
How do you install code-server?
Use the project install script, which detects Debian or Ubuntu and installs the latest release as a .deb package. Preview what it will do first with --dry-run.
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
curl -fsSL https://code-server.dev/install.sh | sh
code-server --versionThe script asks for your sudo password to install the package. If you prefer not to pipe a script into a shell, download the code-server_VERSION_amd64.deb file from the GitHub releases page and install it with sudo apt install ./code-server_*_amd64.deb; the result is identical.
How do you run it as a service and set the password?
The package includes a systemd template unit that runs code-server as the user named after the @. Start it once to create the config file, then edit the password and address.
sudo systemctl enable --now code-server@$USER
sleep 2
nano ~/.config/code-server/config.yamlbind-addr: 127.0.0.1:8080
auth: password
password: use-a-long-random-passphrase-here
cert: falsechmod 600 ~/.config/code-server/config.yaml
sudo systemctl restart code-server@$USER
systemctl status code-server@$USER --no-pager
ss -tlnp | grep 8080The ss line must show 127.0.0.1:8080. To avoid a plain-text password, replace the password: line with hashed-password: and an Argon2 hash, as described in the code-server FAQ. For the passphrase itself, openssl rand -base64 24 produces a strong random value.
How do you publish code-server over HTTPS?
Terminate TLS in a reverse proxy that passes WebSockets; the editor uses them for the terminal and live file events. With Caddy:
code.example.net {
reverse_proxy 127.0.0.1:8080
}With Nginx, save this block and run Certbot on it:
server {
listen 80;
listen [::]:80;
server_name code.example.net;
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;
}
}sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d code.example.net
sudo ufw allow 80,443/tcpOpen https://code.example.net, enter the password and the editor loads. Without HTTPS, browsers block clipboard access and some webviews, so always use the TLS address. The Caddy tutorial and Certbot guide cover each proxy in detail.
How do you add a second layer of protection?
Put a login gateway or a network restriction in front so the password is not the only barrier. Two simple options:
- Forward auth: protect
code.example.netwith Authelia and setauth: nonein code-server, so the gateway with two-factor is the single login. - Private access: leave the proxy off entirely and reach the editor through an SSH tunnel,
ssh -L 8080:127.0.0.1:8080 deploy@198.51.100.24, then browse tohttp://localhost:8080on your machine.
Also install fail2ban or similar to slow password guessing if the login page is public; code-server already rate limits attempts, but extra layers are cheap.
How do you install extensions and tools?
Extensions come from the Open VSX registry by default. Search in the Extensions panel, or install from the command line:
code-server --install-extension ms-python.python
code-server --install-extension esbenp.prettier-vscode
code-server --list-extensionsA few extensions published only to the Microsoft marketplace are not available there; their .vsix files can be installed with --install-extension ./file.vsix where the licence permits. Install the language toolchains on the server itself, for example with the Node.js or Python guides, since the editor runs them there.
How do you update code-server?
Run the install script again; it replaces the package with the newest release. Then restart your service.
curl -fsSL https://code-server.dev/install.sh | sh
sudo systemctl restart code-server@$USER
code-server --versionSettings, extensions and the workspace live under ~/.config/code-server and ~/.local/share/code-server, so updates keep them. Include those folders and your project directories in backups, for example with the daily backups add-on or restic.
What are common code-server problems?
- Blank page or reconnect loop: the proxy is not passing WebSocket upgrades. Check the
UpgradeandConnectionheaders. - "Address already in use": another app owns port 8080. Change
bind-addrto127.0.0.1:8443and update the proxy. - Editor slow or killed: language servers ran out of memory. Watch
free -h, add a swap file, or move to a bigger plan. - Service fails at boot: read
journalctl -u code-server@deploy -n 50; a YAML typo in the config is the usual cause.
Plans that fit this guide
Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.
| Plan | Fits because | Size | Monthly | Order from |
|---|---|---|---|---|
| A1-2 | editing and small scripts | 1 vCPU, 2 GB RAM, 50 GB NVMe | $7.20/mo | $43.20 for 6 months |
| A2-4 | web projects with language servers | 2 vCPU, 4 GB RAM, 100 GB NVMe | $14.40/mo | $43.20 for 3 months |
| F4-16 | large builds and heavy toolchains | 4 vCPU, 16 GB RAM, 384 GB NVMe | $57.60/mo | $57.60 for 1 month |
Questions about VS Code in the browser (code-server)
Is code-server the same as VS Code?
It is built from the open source VS Code code base, so the editor, settings and most extensions behave the same. Some proprietary Microsoft features and extensions are not included.
Can several people share one code-server?
Each instance is one user account with full shell access. For several people, run one service per Linux user (code-server@alice, code-server@bob) on different ports.
Can I use it from a phone or tablet?
Yes, it runs in mobile browsers, and it can be installed as a progressive web app for a full-screen window. A hardware keyboard makes it practical.
Does code-server need outgoing mail?
No. It sends no email. Git commit notifications and similar come from your Git host, not from the editor.
Which plan suits code-server?
For scripting and web projects a 2 GB plan is comfortable. Heavy builds and large language servers benefit from 4 to 8 GB and more vCPU.
More in Self-hosted apps
- Nextcloud on Nginx
- ownCloud Infinite Scale
- Seafile file sync
- Vaultwarden password vault
- Passbolt team password manager
- Gitea Git hosting
- Forgejo Git server
- GitLab Community Edition
- Gogs Git service
- Wiki.js
- BookStack documentation
- Outline knowledge base
- Paperless-ngx documents
- n8n workflow automation
- Activepieces automation
- Plausible Analytics (Community Edition)
- Umami analytics
- Mattermost team chat
- Matrix Synapse with Element
- Jitsi Meet video calls
- ONLYOFFICE Docs with Nextcloud
- HashiCorp Vault secrets server
- OpenBao secrets management
- Infisical secrets manager
- Authelia SSO and forward auth
- Zitadel identity platform
- Joplin Server for notes sync
- Firefly III personal finance
- Snipe-IT asset tracking
- Odoo ERP on Ubuntu or Debian
- ERPNext with frappe_docker
- Dolibarr ERP and CRM with Nginx
- Penpot design tool with Docker
- Planka kanban boards
- Leantime project management
- Wekan boards with Docker
- Cal.com scheduling
- Chatwoot support inbox
- Mautic marketing automation
- DocuSeal document signing
- Metabase dashboards
- Appwrite backend server
- Self-hosted Supabase
- PocketBase backend
- RustDesk relay server
- Traccar GPS tracking
- Redmine project tracker
- The Lounge IRC client
- CyberChef data toolbox
- Typebot chat forms
- AFFiNE workspace
- Overleaf Community Edition
- Neko shared virtual browser
- imgproxy image resizing
- NetBox network inventory
- UVdesk help desk
- YetiForce CRM