29 October 2023

Using VSCode Server + VScode (just Editor) [ On Linux Server ]


VSCode: Visual Studio Code.

I have been reading and reading about the 'Server', but the information seemed conflicting.

For example, here [1] they mention the Server, but they don't say how to install it or where to get it.

[1] https://code.visualstudio.com/docs/remote/remote-overview

Then there is this [2] which talks about 'run vscode anywhere and access it in the browser'.

[2] https://github.com/coder/code-server

"In the browser" vs. "in VSCode Editor"
Both, one?


Well, [3] says "connect to that remote machine from anywhere through a local VS Code client". Since this comes from the original 'vscode studio' website, it seems the 'Server' I want is meant to be accessed from the VSCode (editor) and not from a Browser.

[3] https://code.visualstudio.com/docs/remote/vscode-server


Good, but how do I install it?

Things started to get clear with
https://code.visualstudio.com/docs/remote/remote-overview
which led me to
https://code.visualstudio.com/docs/remote/ssh

-------------------------------------------------------------------

Solution:
The Server is installed by the Client (the normal VSCode editor) running on the Client/Desktop, who connects via SSH to the Server.


If you already have "A Server, with linux and SSH access configured" you are on the quick and easy track.

Everything you need to do is:

1. In your (let's call it) Desktop PC, install VSCode




2. Install the required extension:

They talk about the Remote Development extension pack, which has 4 components. 



But after careful reading, if your case is like mine (a proper Linux server with SSH setup and keys, etc), you only need the 'Remote SSH', which can be installed individually.





Click on the green corner and then 'Connect to Host'




Once you do that, it will download the Installation package for the Server on the Server and install it. You only have to wait.

While you wait, you can see what is happening on the Server (output from htop )



and that's it!


I have read tons of websites with instructions and configurations...  Most of it is unnecessary, or takes you to other places.

Obviously things change if the Server is on a different network, or doesn't have SSH keys. But if your Server is like in my case, a VM running nearby, the process is actually very simple (once you know how).


Summary:

Server
Linux, with SSH configured


Desktop
Access to Server via SSH verified.
Keys to access the Server already installed/configured.


Actions (on Desktop):
1. Install VSCode
2. Within VSCode: Add the "Remote - SSH" Extension
3. Within VSCode: Connect to Server: This connection will install the server component of VSCode (VSCode Server) on the Server, and connect to it.
4. Now you have a VSCode (client) connected and running/using stuff on the Server.



Too Cool for Internet Explorer