Berzelius VS Code Guide

Introduction

Visual Studio Code (often abbreviated as VS Code) is a free and open-source code editor developed by Microsoft.

VS Code has an Remote-SSH extension that allows you to remotely connect to and work on a remote server over SSH. This extension is helpful for developing and editing code on a remote system without leaving the VSCode environment.

VS Code Server is a service that allows users to run VS Code on a remote server and access it via a web browser.

Running VS Code on Berzelius

We have a VS Code module on Berzelius. After connecting to Berzelius via Thinlinc, you can load the module and run VS Code by

module load VSCode/1.89.1-bdist
XDG_RUNTIME_DIR=~/.vscode/runtime code /your/working/dir

Make sure that the directory ~/.vscode/runtime exists.

Using VS Code Remote-SSH to Connect to Berzelius

Installing VS Code on Your Local Computer

Follow the instructions and install VS Code on your local computer.

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.

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.

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.



Open a Terminal on Berzelius

You can have a terminal on Berzelius by clicking Terminal → New Terminal on the top menu bar.

Close the Connection

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

Using VS Code Server to Connect to Berzelius

Loading the VS Code Server module

We have a module of VS Code Server on Berzelius. You can load the module by

module load VSCode-Server/4.89.1-bdist

Starting VS Code Server

With an interactive session, execute the command on a compute node node0xy to start VS Code

code-server --bind-addr node0xy:9988 ./your/working/dir

The port 9988 is arbitrary. If 9988 is already in use, then just try 9989, etc.

Setting up a SSH tunnel

Open a local terminal, make a SSH tunnel login:

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

Connecting to VS Code Server

Start your favorite browser on your local computer, paste the following URL given by VS Code Server on Berzelius:

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