install Visual Studio Code on a Server to use it via web-browser

the easiest way is to use a script from which also provides a simple password authentication.

before you begin though, think about security! the setup will write a password into a config file in your home directory in clear text. with this password, anyone can login to your visual studio and in there, whoever is logged in prettymuch has full control over your user on the server, as one can start a terminal, edit and create files etc. I would not run this on a production server. Instead i am using this in a docker container that i use to fiddle around with php scripts and other things locally on my notebook

run the following commands with an unprivileged user who has sudo rights to execute dpkg. you can remove those rights from the user again after the installation is complete.

curl -fsSL | sh

you can now start code-server


or you can start it as a service as well:

sudo systemctl enable --now code-server@$USER

check out code-server –help to see what else you can configure / do with it. for example you can install some extensions right from the command line (if you want to script the installation in a Dockerfile for example)

code-server --install-extension "Sophisticode.php-formatter"
code-server --install-extension "bmewburn.vscode-intelephense-client"
code-server --install-extension "bradgashler.htmltagwrap"

Alternatively one could also use an editor that was designed to run as a web-service from the get-go with this kind of deployment in focus. Like for example ICEcoder

  • install_visual_studio_code_on_a_server_to_use_it_via_web-browser.txt
  • Last modified: 13.11.2020 09:41
  • by Pascal Suter