Install code-server: OS Instructions for VS Code | code-server Docs (original) (raw)

This document demonstrates how to install code-server on various distros and operating systems.

install.sh

The easiest way to install code-server is to use our install script for Linux, macOS and FreeBSD. The install scriptattempts to use the system package manager if possible.

You can preview what occurs during the install process:

curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run

To install, run:

curl -fsSL https://code-server.dev/install.sh | sh

You can modify the installation process by including one or more of the following flags:

When done, the install script prints out instructions for running and starting code-server.

If you're concerned about the install script's use of curl | sh and the security implications, please see this blog postby sandstorm.io.

If you prefer to install code-server manually, despite the detection references and --dry-run feature, then continue on for information on how to do this. The install.sh script runs the_exact_ same commands presented in the rest of this document.

Detection reference

npm

We recommend installing with npm when:

  1. You aren't using a machine with amd64 or arm64.
  2. You are installing code-server on Windows.
  3. You're on Linux with glibc < v2.28 or glibcxx < v3.4.21.
  4. You're running Alpine Linux or are using a non-glibc libc. See#1430for more information.

Installing code-server with npm builds native modules on install.

This process requires C dependencies; see our guide on installing with npm for more information.

Standalone releases

We publish self-contained .tar.gz archives for every release onGitHub. The archives bundle the node binary and node modules.

We create the standalone releases using the npm package, and we then create the remaining releases using the standalone version.

The only requirement to use the standalone release is glibc >= 2.28 andglibcxx >= v3.4.21 on Linux (for macOS, there is no minimum system requirement).

To use a standalone release:

  1. Download the latest release archive for your system fromGitHub.
  2. Unpack the release.
  3. Run code-server by executing ./bin/code-server.

You can add ./bin/code-server to your $PATH so that you can executecode-server without providing full path each time.

Here is a sample script for installing and using a standalone code-server release on Linux:

mkdir -p ~/.local/lib ~/.local/bin
curl -fL https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-linux-amd64.tar.gz \
  | tar -C ~/.local/lib -xz
mv ~/.local/lib/code-server-$VERSION-linux-amd64 ~/.local/lib/code-server-$VERSION
ln -s ~/.local/lib/code-server-$VERSION/bin/code-server ~/.local/bin/code-server
PATH="~/.local/bin:$PATH"
code-server
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml

Debian, Ubuntu

The standalone arm64 .deb does not support Ubuntu 16.04 or earlier. Please upgrade or build with npm.

curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server_${VERSION}_amd64.deb
sudo dpkg -i code-server_${VERSION}_amd64.deb
sudo systemctl enable --now code-server@$USER
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml

Fedora, CentOS, RHEL, SUSE

The standalone arm64 .rpm does not support CentOS 7. Please upgrade or build with npm.

curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server-$VERSION-amd64.rpm
sudo rpm -i code-server-$VERSION-amd64.rpm
sudo systemctl enable --now code-server@$USER
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml

Arch Linux

# Install code-server from the AUR using yay.
yay -S code-server
sudo systemctl enable --now code-server@$USER
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
# Install code-server from the AUR with plain makepkg.
git clone https://aur.archlinux.org/code-server.git
cd code-server
makepkg -si
sudo systemctl enable --now code-server@$USER
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml

Artix Linux

# Install code-server from the AUR
git clone https://aur.archlinux.org/code-server.git
cd code-server
makepkg -si

Save the file as code-server in /etc/init.d/ and make it executable with chmod +x code-server. Put your username in line 3.

#!/sbin/openrc-run
name=$RC_SVCNAME
description="$name - VS Code on a remote server"
user="" # your username here
homedir="/home/$user"
command="$(which code-server)"
# Just because you can do this does not mean you should. Use ~/.config/code-server/config.yaml instead
#command_args="--extensions-dir <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>h</mi><mi>o</mi><mi>m</mi><mi>e</mi><mi>d</mi><mi>i</mi><mi>r</mi><mi mathvariant="normal">/</mi><mi mathvariant="normal">.</mi><mi>l</mi><mi>o</mi><mi>c</mi><mi>a</mi><mi>l</mi><mi mathvariant="normal">/</mi><mi>s</mi><mi>h</mi><mi>a</mi><mi>r</mi><mi>e</mi><mi mathvariant="normal">/</mi></mrow><annotation encoding="application/x-tex">homedir/.local/share/</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">h</span><span class="mord mathnormal">o</span><span class="mord mathnormal">m</span><span class="mord mathnormal">e</span><span class="mord mathnormal">d</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.02778em;">r</span><span class="mord">/.</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">oc</span><span class="mord mathnormal">a</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord">/</span><span class="mord mathnormal">s</span><span class="mord mathnormal">ha</span><span class="mord mathnormal">re</span><span class="mord">/</span></span></span></span>name/extensions --user-data-dir <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>h</mi><mi>o</mi><mi>m</mi><mi>e</mi><mi>d</mi><mi>i</mi><mi>r</mi><mi mathvariant="normal">/</mi><mi mathvariant="normal">.</mi><mi>l</mi><mi>o</mi><mi>c</mi><mi>a</mi><mi>l</mi><mi mathvariant="normal">/</mi><mi>s</mi><mi>h</mi><mi>a</mi><mi>r</mi><mi>e</mi><mi mathvariant="normal">/</mi></mrow><annotation encoding="application/x-tex">homedir/.local/share/</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">h</span><span class="mord mathnormal">o</span><span class="mord mathnormal">m</span><span class="mord mathnormal">e</span><span class="mord mathnormal">d</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.02778em;">r</span><span class="mord">/.</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">oc</span><span class="mord mathnormal">a</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord">/</span><span class="mord mathnormal">s</span><span class="mord mathnormal">ha</span><span class="mord mathnormal">re</span><span class="mord">/</span></span></span></span>name --disable-telemetry"
command_user="$user:$user"
pidfile="/run/$name/$name.pid"
command_background="yes"
extra_commands="report"

depend() {
  use logger dns
  need net
}

start_pre() {
  checkpath --directory --owner <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>c</mi><mi>o</mi><mi>m</mi><mi>m</mi><mi>a</mi><mi>n</mi><msub><mi>d</mi><mi>u</mi></msub><mi>s</mi><mi>e</mi><mi>r</mi><mo>−</mo><mo>−</mo><mi>m</mi><mi>o</mi><mi>d</mi><mi>e</mi><mn>0755</mn><mi mathvariant="normal">/</mi><mi>r</mi><mi>u</mi><mi>n</mi><mi mathvariant="normal">/</mi></mrow><annotation encoding="application/x-tex">command_user --mode 0755 /run/</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8444em;vertical-align:-0.15em;"></span><span class="mord mathnormal">co</span><span class="mord mathnormal">mman</span><span class="mord"><span class="mord mathnormal">d</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">u</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord mathnormal" style="margin-right:0.02778em;">ser</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">−</span><span class="mord mathnormal">m</span><span class="mord mathnormal">o</span><span class="mord mathnormal">d</span><span class="mord mathnormal">e</span><span class="mord">0755/</span><span class="mord mathnormal" style="margin-right:0.02778em;">r</span><span class="mord mathnormal">u</span><span class="mord mathnormal">n</span><span class="mord">/</span></span></span></span>name /var/log/$name
}

start() {
  default_start
  report
}

stop() {
  default_stop
}

status() {
  default_status
  report
}

report() {
  # Report to the user
  einfo "Reading configuration from ~/.config/code-server/config.yaml"
}

Start on boot with default runlevel

rc-update add code-server default

Start the service immediately

rc-service code-server start

macOS

brew install code-server
brew services start code-server
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml

Docker

# This will start a code-server container and expose it at http://127.0.0.1:8080.
# It will also mount your current directory into the container as `/home/coder/project`
# and forward your UID/GID so that all file system operations occur as your user outside
# the container.
#
# Your <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>H</mi><mi>O</mi><mi>M</mi><mi>E</mi><mi mathvariant="normal">/</mi><mi mathvariant="normal">.</mi><mi>c</mi><mi>o</mi><mi>n</mi><mi>f</mi><mi>i</mi><mi>g</mi><mi>i</mi><mi>s</mi><mi>m</mi><mi>o</mi><mi>u</mi><mi>n</mi><mi>t</mi><mi>e</mi><mi>d</mi><mi>a</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">HOME/.config is mounted at </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.08125em;">H</span><span class="mord mathnormal" style="margin-right:0.05764em;">OME</span><span class="mord">/.</span><span class="mord mathnormal">co</span><span class="mord mathnormal">n</span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.03588em;">g</span><span class="mord mathnormal">i</span><span class="mord mathnormal">s</span><span class="mord mathnormal">m</span><span class="mord mathnormal">o</span><span class="mord mathnormal">u</span><span class="mord mathnormal">n</span><span class="mord mathnormal">t</span><span class="mord mathnormal">e</span><span class="mord mathnormal">d</span><span class="mord mathnormal">a</span><span class="mord mathnormal">t</span></span></span></span>HOME/.config within the container to ensure you can
# easily access/modify your code-server config in $HOME/.config/code-server/config.json
# outside the container.
mkdir -p ~/.config
docker run -it --name code-server -p 127.0.0.1:8080:8080 \
  -v "$HOME/.local:/home/coder/.local" \
  -v "$HOME/.config:/home/coder/.config" \
  -v "$PWD:/home/coder/project" \
  -u "$(id -u):$(id -g)" \
  -e "DOCKER_USER=$USER" \
  codercom/code-server:latest

Our official image supports amd64 and arm64. For arm32 support, you can use a community-maintained code-server alternative.

Helm

You can install code-server using the Helm package manager.

Windows

We currently do not publish Windows releases. We recommend installing code-server onto Windows with npm.

Raspberry Pi

We recommend installing code-server onto Raspberry Pi with npm.

If you see an error related to node-gyp during installation, See #5174 for more information.

Termux

Please see code-server's Termux docs for more information.

Cloud providers

We maintain one-click apps and install scripts for cloud providers such as DigitalOcean, Railway, Heroku, and Azure.

Uninstall

code-server can be completely uninstalled by removing the application directory, and your user configuration directory.

To delete settings and data:

rm -rf ~/.local/share/code-server ~/.config/code-server

install.sh

If you installed with the install script, by default code-server will be in ~/.local/lib/code-server-<version> and you can remove it with rm -rf. e.g.

rm -rf ~/.local/lib/code-server-*

Homebrew

To remove the code-server homebrew package, run:

brew remove code-server

# Alternatively
brew uninstall code-server

npm

To remove the code-server global module, run:

npm uninstall --global code-server

Debian, Ubuntu

To uninstall, run:

sudo apt remove code-server