Skip to content

Set Up code-server on a Linux VPS – VS Code in Your Browser on Any Device

Set up code-server on your Linux VPS: use the One-Click App for HTTPS and password protection, or install it manually with Docker Compose. Includes login, terminal and sudo, Open VSX extensions, Git projects, backups, and updates.

27 November 202613 min read1 Views0 helpful

Introduction

code-server brings Visual Studio Code to your browser. The editor runs on your server, and you open it on any device with a browser to get the familiar interface with a file tree, Git view, extensions, and terminal. Your code, tools, and computing power stay on the server. In this guide, we’ll show you two ways to set it up: the easy way as a One-Click App, which makes code-server available with HTTPS and a password in just a few clicks, and a manual installation with Docker Compose. After that, you’ll fetch a project with Git, install extensions, and set up languages such as Python.

When code-server on a VPS makes sense

A browser-based editor of your own is useful when:

  • You want to program from different devices, such as a tablet, a borrowed PC, or a Chromebook where you can’t or aren’t allowed to install anything.
  • You want your projects and tools in one place: Open your browser and pick up right where you left off, no matter which device you’re using.
  • You want to use less powerful devices: Builds, dependencies, and tests run on the VPS, not your laptop.
  • You want to edit scripts, bots, or configurations directly on the server, with syntax highlighting and a terminal instead of using nano over SSH.

code-server is less suitable if you already work on your own computer with VS Code installed. In that case, Microsoft’s Remote - SSH extension is often the better choice (see the next section). code-server is also not designed for multiple people: there is exactly one password and no user management.

code-server or VS Code with Remote-SSH?

Both options let you edit code on the server. The difference is what you need on your device and which extensions are available:

code-serverVS Code with Remote-SSH
On your devicejust a browserinstalled VS Code and SSH access
Tablet, borrowed PCyesno
Extensionsfrom the open Open VSX galleryfrom the Microsoft Marketplace
Live Share, Pylance, Remote extensionsnot availableavailable
Keyboard shortcutssome are captured by the browserwork as usual
Loginpassword in the browserSSH key

The reason for using a different gallery: according to the code-server FAQ, the Microsoft Marketplace terms of use allow extensions only in Microsoft products. code-server therefore uses Open VSX. Many well-known extensions are available there too, but closed-source Microsoft extensions such as Live Share, Pylance, and the Remote extensions are not.

The easy way: code-server as a One-Click App

The quickest way to get started with code-server is through your VPS’s One-Click Apps. With a domain, the app is available directly over HTTPS and is protected by a randomly generated password at startup. You don’t need a reverse proxy or certificate.

Requirements

  • A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Set Up One-Click Apps for instructions.
  • Enough resources: the app catalog lists at least 1 CPU core, 1 GB RAM, and 3 GB of storage; 2 cores, 2 GB RAM, and 20 GB are recommended. Extensions such as language servers and your own builds can quickly require more memory.

Install

  1. Open your VPS in the ZapX dashboard and go to the One-Click Apps tab.
  2. Search the app catalog for Code Server and click Install app.
  3. Use a custom subdomain or zap.cloud is already selected, with a randomly generated name. Leave it enabled or enter your own name. Without a domain, the editor and password login would only be accessible over HTTP.
  4. You don’t need to fill in anything under App configuration. The app generates two values automatically: SERVICE_PASSWORD_64_PASSWORDCODESERVER for login and SERVICE_PASSWORD_SUDOCODESERVER for sudo in the terminal.
  5. Click Queue installation. After about a minute, code-server will appear online on the app card.

First login

The app card will already tell you that the password was generated during installation. You can find it in the app settings (gear icon), under App environment > Automatically generated values, as SERVICE_PASSWORD_64_PASSWORDCODESERVER. It’s 64 characters long, so it’s best to copy it.

  1. Open the app’s Access link.
  2. The Welcome to code-server page appears, with a note that the password comes from $PASSWORD. Enter the password and click Submit.
  3. code-server opens the working directory /config/workspace directly.

According to the documentation, code-server allows only two login attempts per minute and twelve more per hour. There is no username, just this one password. Save it in a password manager and don’t share it.

Warning

Anyone with the password has terminal access to your server code-server includes a full-featured terminal. Anyone who logs in can run commands and install programs with the sudo password. Treat the login password like SSH credentials.

Working directory and trust

The first time you open code-server, you’ll see Restricted Mode at the top. This protects you from unfamiliar files that could run code when opened. When you open the terminal for the first time, code-server asks Do you trust the authors of the files in this folder? For your own projects, click Trust Folder & Continue.

Anything you want to keep is stored in the Docker volume under /config: your working directory /config/workspace, settings, installed extensions, and SSH keys in /config/.ssh. This content is preserved through restarts and updates.

Terminal: where it runs and what it can do

The terminal doesn’t run directly on your VPS, but inside the app’s container. In our test, it showed Ubuntu 24.04 and ran as the abc user (UID 1000) without root privileges. With sudo and the second generated password, SERVICE_PASSWORD_SUDOCODESERVER, you become root inside the container. This does not give you access to your VPS itself, other apps, or Docker because the Docker socket isn’t mounted.

The container comes with git, curl, and sudo, among other tools. Python, Node.js, and other languages are not included, but you can install them later (see below).

Updates and backups

Update code-server in the app settings (gear icon), under App update. Click Check for updates, then install a new version with Apply update. If the page says the app is up to date, no newer version is available in the app catalog yet. The app uses the linuxserver.io image with code-server 4.145.2. If the editor itself shows a newer version at the bottom right, that indicates the latest project version. You can install it only after it becomes available in the app catalog.

Info

Reinstall packages added after an update An update recreates the container. Everything under /config is preserved, but packages you installed with apt will be gone. Keep a short list or a script in your working directory to track them.

A volume is not a backup. It’s best to keep your projects in a Git repository on another server, such as GitHub or your own Forgejo. To make a copy of the entire volume, use SSH on your VPS to archive it:

Code
C=$(docker ps --format '{{.Names}}' | grep '^code-server-')
docker exec $C tar -czf /tmp/code-server-backup.tar.gz -C /config workspace data extensions .ssh
docker cp $C:/tmp/code-server-backup.tar.gz .

Then copy the file to your computer over SFTP. The archive also contains your SSH keys, so store it securely.

Manual installation

The rest of this guide describes a manual installation of code-server with Docker Compose. We’ll use the same image from linuxserver.io as the One-Click App. The instructions on reverse proxies and extensions are from the official code-server documentation.

Requirements

  • A Linux VPS running Debian or Ubuntu, with SSH access. See First SSH Access.
  • Docker and Docker Compose. See Install Docker. Verify the installation with docker --version and docker compose version.
  • For HTTPS: a domain or subdomain whose A record points to your VPS’s IP address (e.g., code.example.com).
ResourceMinimumRecommended
CPU1 core2 cores
RAM1 GB2 GB or more
Storage3 GB20 GB or more

The official documentation recommends at least 1 GB RAM and 2 CPU cores. Language servers, dependencies, and project builds will increase resource requirements.

Prepare the firewall

code-server listens on port 8443 inside the container. Don’t expose the port externally; access is handled through the reverse proxy. With ufw, allow only SSH, HTTP, and HTTPS:

Code
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
Warning

Docker bypasses ufw Ports published by Docker using ports: are accessible externally even if ufw blocks them. So, as shown in the Compose file below, bind code-server only to 127.0.0.1. For more information about the firewall, see Manage the Firewall on Linux.

Install with Docker Compose

Create a directory and generate two random passwords in a .env file that only root can read:

Code
mkdir -p /opt/code-server && cd /opt/code-server
echo "PASSWORD=$(openssl rand -base64 32)" > .env
echo "SUDO_PASSWORD=$(openssl rand -base64 24)" >> .env
chmod 600 .env

Create the Compose file with nano docker-compose.yml:

Code
services:
  code-server:
    image: lscr.io/linuxserver/code-server:4.145.2
    container_name: code-server
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
      - PASSWORD=${PASSWORD}
      - SUDO_PASSWORD=${SUDO_PASSWORD}
      - DEFAULT_WORKSPACE=/config/workspace
    volumes:
      - ./config:/config
    ports:
      - "127.0.0.1:8443:8443"
    restart: unless-stopped

Here’s what the entries mean:

  • image: code-server version 4.145.2, as used by the One-Click App. You can deliberately specify a new version later.
  • PUID and PGID: the user and group IDs that the editor runs under in the container. Files in the config directory will therefore belong to the user with ID 1000 on the server.
  • PASSWORD: the login password from the .env file. According to the documentation, if both PASSWORD and HASHED_PASSWORD are missing, code-server starts without authentication. Instead of plain text, you can set an Argon2 hash with HASHED_PASSWORD. In the Compose file, write every $ in the hash as $$.
  • SUDO_PASSWORD: lets you use sudo in the terminal. If you leave out this line, sudo won’t be available.
  • ./config:/config: the working directory, settings, extensions, and SSH keys are stored in the config directory beside the Compose file.
  • 127.0.0.1:8443:8443: code-server is accessible only from the server itself; external access goes through the reverse proxy.

Start the container:

Code
docker compose up -d

Check whether it’s running with docker compose ps and view the logs with docker compose logs -f.

Tip

Install without Docker code-server also provides an installation script that installs the appropriate package on Debian and Ubuntu: curl -fsSL https://code-server.dev/install.sh | sh. Add --dry-run at the end to preview what it would do. Then start the service with systemctl enable --now code-server@$USER. It listens on 127.0.0.1:8080, and the password is in ~/.config/code-server/config.yaml. This runs the editor directly on the server with your user’s permissions, not in a container.

First access

Because code-server listens only on 127.0.0.1, it’s best to set up the reverse proxy from the next section first. For a quick test, open the editor from your computer through an SSH tunnel:

Code
ssh -L 8443:localhost:8443 root@SERVER_IP

Replace SERVER_IP with your VPS’s IP address and open http://localhost:8443 in your browser. Log in with the password you can display on the server using grep PASSWORD /opt/code-server/.env.

Access over HTTPS through a reverse proxy

To access code-server externally, put a reverse proxy with a valid certificate in front of it. For the basics, see Set Up a Reverse Proxy with nginx and Create an SSL Certificate (Let's Encrypt). Important: code-server communicates with the browser over WebSockets. Without the Upgrade and Connection lines, the interface won’t load completely, and the terminal and editor will hang. Here’s an nginx server block based on the code-server documentation:

Code
server {
    listen 80;
    listen [::]:80;
    server_name code.example.com;

    location / {
        proxy_pass http://127.0.0.1:8443/;
        proxy_set_header Host $http_host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection upgrade;
        proxy_set_header Accept-Encoding gzip;
    }
}

Then get the certificate with certbot --nginx -d code.example.com. Certbot adds HTTPS and HTTP redirection to the block. With Caddy, two lines are enough because Caddy handles WebSockets and certificates automatically: code.example.com, followed by reverse_proxy 127.0.0.1:8443. For more security tips, see Linux Security Tips.

Back up your data

All data is stored in the config directory beside the Compose file. Briefly stop code-server to make a consistent backup:

Code
cd /opt/code-server
docker compose stop
tar -czf /root/code-server-backup-$(date +%F).tar.gz config docker-compose.yml .env
docker compose start

Then copy the archive to a different storage location. It contains your passwords and SSH keys, so store it securely.

Update code-server

linuxserver.io recommends not updating programs inside the container. Instead, switch the image and recreate the container. To do this, specify the new version in docker-compose.yml—you can find it among the image releases—and restart:

Code
cd /opt/code-server
docker compose pull
docker compose up -d

The config directory is preserved. As with the One-Click App, packages you installed in the container with apt will be gone. Remove old images with docker image prune.

Working with code-server

After logging in, set up code-server for your projects. Everything in this section applies to both the One-Click App and the manual installation.

Get a project with Git

Open the terminal from the menu in the top left > Terminal > New Terminal. Clone your project in the working directory:

Code
cd /config/workspace
git clone https://github.com/BENUTZER/REPO.git

In our test, the repository appeared directly in the file tree on the left. Before making your first commits, set your name and email address:

Code
git config --global user.name "Dein Name"
git config --global user.email "du@example.com"

To access private repositories over SSH, create a key in the terminal with ssh-keygen -t ed25519 and add the public key from /config/.ssh/id_ed25519.pub to GitHub, GitLab, or your own Git server. The key is stored in the volume and will be preserved. For more information about Git on the server, see Install Git.

Install extensions

Install extensions using the Extensions icon on the left or by pressing Ctrl + Shift + X. The search uses Open VSX. The first time you install something from a publisher, code-server asks whether you trust them (Trust Publisher & Install). Extensions run code on your server, so check who they come from.

You can also install extensions from the terminal using their identifier:

Code
/app/code-server/bin/code-server --install-extension ms-python.python

In our test, this command installed the Python extension, including its debugger, from Open VSX. Pylance, on the other hand, returned not found because it’s only available in the Microsoft Marketplace. For installations using the script without Docker, the command is simply code-server --install-extension .... If an extension isn’t available in Open VSX, you can download a .vsix file from the project’s releases and install it through the command palette using Extensions: Install from VSIX.

Install languages and tools

The container includes only basic tools. Install languages such as Python in the terminal using sudo:

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

sudo will ask for the sudo password: for the One-Click App, this is SERVICE_PASSWORD_SUDOCODESERVER under App environment > Automatically generated values; for a manual installation, use the SUDO_PASSWORD value from your .env file. In our test, Python 3.12 was ready to use immediately afterward. It’s better to install tools needed only by your project in the working directory, such as Python packages in a virtual environment created with python3 -m venv .venv. These will be preserved during updates.

If you start a development server in a project, for example on port 3000, the documentation says you can access it at https://code.example.com/proxy/3000/, protected by the same login as code-server.

Work on a tablet or borrowed PC

The browser captures many keyboard shortcuts, such as Ctrl + W. The code-server documentation therefore recommends installing the editor as an app: in Chrome, use the install icon in the address bar; on an iPad in Safari, tap Share > Add to Home Screen. code-server will then run in its own window and receive the keyboard shortcuts. On a computer that isn’t yours, it’s best to use a private browser window and close it afterward so no one can continue using your session.

Limitations

  • One login for everyone: code-server has just one password and no user accounts. For multiple people, it’s better to use a separate instance for each person, ideally on separate servers according to the documentation.
  • No Docker in the editor: the Docker socket isn’t mounted in the One-Click App. So Docker commands for your projects won’t run in the code-server terminal; use SSH to run them on the VPS instead.
  • No Microsoft Marketplace: Live Share, Pylance, and the Remote extensions are unavailable. For Python, Open VSX offers free language servers as alternatives, such as Pyrefly.
  • Storage and memory: projects, dependencies, and language servers use disk space and RAM on the VPS. If you run short on resources, upgrade it in the Manage plan tab of your VPS.

Conclusion

You’ve set up code-server on your VPS, logged in, and learned how to get projects with Git, install extensions from Open VSX, add languages to the container, and back up your data. You now have VS Code on any device with a browser, from a tablet to a borrowed PC.

Prefer not to handle Docker yourself? Then take the easy route with the One-Click App, as described above under “The easy way: code-server as a One-Click App.”

Free tools

Related tools for servers and developers

View all

FAQ

Frequently asked questions

The One-Click App is the quickest option: code-server runs over HTTPS after just a few clicks, the login password is generated automatically, and you can install updates in the ZapX dashboard under App Update. A manual Docker Compose installation is useful if you don’t use One-Click Apps on your server or want to manage the folders, passwords, and reverse proxy yourself.
For the One-Click App, open the app settings (gear icon) and go to App Environment > Automatically Generated Values. The login password is listed as SERVICE_PASSWORD_64_PASSWORDCODESERVER, and the password for sudo in the terminal is SERVICE_PASSWORD_SUDOCODESERVER. For a manual installation, both are in the .env file beside the Compose file.
No. The Microsoft Marketplace terms of use allow extensions only in Microsoft products, so code-server uses the open Open VSX gallery instead. It has many well-known extensions, including the Python extension, but not closed-source Microsoft extensions such as Live Share, Pylance, or the Remote extensions.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.