What is it?
It’s a self-hosted instance of VS Code, accessible from the internet on any internet-capable device. It’s available on GitHub.
Why bother? Soem machines might not be able to run VS Code, but it would be nice to try it on them (such as an iPad).
This is more of a way to remind myself what I need to do, if I ever need to reinstall it again.
Installation
Follow the install script instructions here: https://github.com/cdr/code-server#getting-started
After this, you’ll see it mentions something like use sudo systemctl enable --now code-server@$USER
to enable it - well if you do this, it’ll host it at http://127.0.0.1:8008
- yes localhost. It’s pretty useless if you’re trying to connect external clients to it.
So this is how you fix it:
running systemctl status code-server@$USER
should give you something like:
If you follow the path for what file is loaded, you’ll see:
You can add arguments after the end of the ExecStart
line - running code-server --help
will show a list of available commands.
To expose the code-server so that it is accessible from another machine, change the config so that it is like so:
Make sure to change the address after the --bind-addr
text as the IP address assigned to your machine will differ. run systemctl daemon-reload
to apply the changes too
Enable the service file systemctl enable code-server@$USER
and reboot real quick - the code-server should start automatically and you can visit the IP address and you should be greeted with the login screen. you’re good to go!
After this you should be done!
If you plan on accessing it from the great world wide web, be careful and use strong passwords. Unwanted access to the Code instance means easy access to the shell, exposing your files & possibly other machines to danger.