Visual Studio Code (VS Code) is a lightweight, open-source code editor developed by Microsoft. It supports a wide range of programming languages and remote development extensions.
This guide describes three methods for using VS Code with the Berzelius supercomputer:
Methods 1 and 3 allow you to run VS Code directly on a compute node.
This method runs VS Code directly in a graphical ThinLinc session.
We provide a module for VS Code on Berzelius. After logging in through ThinLinc, you can launch VS Code with:
module load VSCode/latest-bdist
XDG_RUNTIME_DIR=~/.vscode/runtime code /your/working/dir
Make sure that the directory ~/.vscode/runtime
exists.
This method connects your local VS Code to Berzelius using SSH.
Follow the official installation guide to install VS Code on your computer.
Click the Extensions tab in the left side panel. Search for “Remote-SSH” and install the extension.
Once it’s installed a new tab (Remote Explorer) will appear on the side panel.
Click the Remote Explorer tab in the left side panel.
Press the plus (+) in the Remote Explorer tab to add a new ssh connection to Berzelius.
Input the ssh connection command.
Update the SSH configuration file. Just hit enter to make the updates. You only need to do it once.
Click the refresh icon in the Remote Explorer and you will see the new SSH connection.
Click “Connect in Current Window..” and Input your password and verification code.
Now you are connected to Berzelius.
You can use the Explorer tab to open your directory on Berzelius.
Click Explorer → Open Folder → Input your directory path. You need to input your password and verification code again.
You can have a terminal on Berzelius by clicking Terminal → New Terminal on the top menu bar.
This terminal gives you access to a fully functional shell running on Berzelius. From here, you can load modules, run scripts and binaries, submit and monitor SLURM jobs, etc.
Tip: You can open multiple terminals (each with a different working directory or environment) by clicking the “+” button in the terminal panel.
You can terminate the ssh connection by clicking File → Close Remote Connection on the top menu bar.
This method runs a full-featured VS Code Server on a login/compute node, accessible via browser.
To load the VS Code Server Module:
module load VSCode-Server/latest-bdist
In an interactive job on a compute node (e.g., node0xy, which is the hostname), you can start the server with the following command:
code-server --bind-addr node0xy:9988 ./your/working/dir
To check your current hostname, you can run
hostname
The port 9988 is arbitrary. if it’s already in use, feel free to try another one (e.g., 9989, 9990, etc.).
From your local computer, create an SSH tunnel:
ssh -N -L localhost:9988:node0xy:9988 <your username>@berzelius1.nsc.liu.se
Open your favorite browser and go to:
http://localhost:9988
The VS Code Server password can be found at /home/<your username>/.config/code-server/config.yaml
.
Guides, documentation and FAQ.
Applying for projects and login accounts.