Code-Server Install (Debian)

Aus MattWiki

This article shows, how to manually install Coder's Code-Server on Debian running Apache webserver.

Code-Server is a web-based version of Visual Studio Code.

Source

Code-Server on GitHub: https://github.com/coder/code-server

Requirements

Code-Server version 4.0.0 and above requires Apache2 version 2.4.48 or higher. Apache 2.4.54 is typically available on Debian 11 Bullseye.

On Debian 10 Buster only Apache2 version 2.4.38 is available. With this only Code-Server version 3.1.2 and lower is compatible

Manual Install

This instructions are based on Coder's original documentation located here:

https://coder.com/docs/code-server/latest/install#debian-ubuntu

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

For this to work you have to specify the version which curl should download. You can find the available versions in the releases section of the GitHub repository: https://github.com/coder/code-server/releases

Look for the download links of the assets section.

Lets assume that the version you wish to install is 4.0.0 and the user for which code server should be installed is Bob then the script above should look as follows:

curl -fOL https://github.com/coder/code-server/releases/download/v4.0.0/code-server_4.0.0_amd64.deb
sudo dpkg -i code-server_4.0.0_amd64.deb
sudo systemctl enable --now code-server@$bob
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml

curl downloads the file to the ~/.cache/code-server directory (of your home directory).

Uninstall

Find out which version is currently installed:

sudo dpkg -l code-server

Uninstall

sudo dpkg -r code-server         # Leave config files
sudo dpkg -P code-server         # Purge and delete all config files

Troubleshooting

Login Fails

Error description: Login fails with websockets error message.

Root cause: Code-Server 4.0.0 and higher requires websockets features which seem only be available on Apache2 2.4.48 or higher

Solutions:

  1. Upgrade to Debian 11 Bullseye. With Apache2 version 2.4.58, which is available on Debian 11 Bullseye Code-Server 4.0.0 or higher code-server works. See requirements section above
  2. Downgrade Code-Server to 3.1.2 or lower. See install/uninstall above