Berzelius VS Code Guide

1. Introduction

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:

  1. Running VS Code directly on Berzelius via ThinLinc.
  2. Using the Remote-SSH extension to connect from your local VS Code.
  3. Running VS Code Server on Berzelius and accessing it from a web browser.

Methods 1 and 3 allow you to run VS Code directly on a compute node.

2. Using VS Code via ThinLinc

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.

3. Using VS Code with Remote-SSH

This method connects your local VS Code to Berzelius using SSH.

3.1 Installing VS Code Locally

Follow the official installation guide to install VS Code on your computer.

3.2 Installing Remote-SSH Extension

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.

3.3 Setting up SSH Connection

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.

3.4 Editing Files on 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.



3.5 Open a Terminal

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.

3.6 Close the Connection

You can terminate the ssh connection by clicking File → Close Remote Connection on the top menu bar.

4. Using VS Code Server in a Browser

This method runs a full-featured VS Code Server on a login/compute node, accessible via browser.

4.1 Loading the VS Code Server Module

To load the VS Code Server Module:

module load VSCode-Server/latest-bdist

4.2 Starting VS Code Server

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.).

4.3 Setting up a SSH Tunnel

From your local computer, create an SSH tunnel:

ssh -N -L localhost:9988:node0xy:9988 <your username>@berzelius1.nsc.liu.se

4.4 Connecting to VS Code Server

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.


User Area

User support

Guides, documentation and FAQ.

Getting access

Applying for projects and login accounts.

System status

Everything OK!

No reported problems

Self-service

SUPR
NSC Express