UCloud Tutorial: SSH Connection to UCloud using Terminal or VSCode¶
Direct SSH Connection is available for a range of different UCloud applications:
- Terminal
- Coder
- RStudio
- JupyterLab
- Ubuntu Xfce - virtual desktop environment
- AlmaLinux Xfce - virtual desktop environment
This tutorial provided a step-by-step guide on how to connect the UCloud application directly to a Terminal or VSCode application on your local PC.
It will also be shown how to setup a conda environment and how to run a jupyter notebook through VSCode.
Prerequisite reading:
Add public SSH key to UCloud¶
Step 1: On UCloud go to "Resources -> SHH-Keys -> Create SSH key"¶
Step 2: Paste pulic key, give a meaningful name and press "Add SSH key".¶
More information can be found in the UCloud documentation.
Start UCloud Job¶
Step 1: Start UCloud Job by filling out the necessary fields. Remember to check the "Enable SSH server" checkbox"¶
Step 2: When job ready please locate and copy the SSH address¶
Connect the using a Local Terminal App¶
Paste the SSH address into a terminal, press enter and follow a few intuitive steps.
Connect using Visual Studio Code (VScode)¶
Open Visual Studio Code (VScode)¶
Install "Remote - SSH" extension¶
Access remote UCloud Job¶
- Press "Ctrl + shift + p" to open Command Palette
- Search and press "Remote-SSH:Connect to Host..."
- Press "Add New SSH Host..."
Paste UCloud Job SSH address and press Enter¶
Follow a few intuitive steps.
Navigate to /work folder on UCloud¶
Run a Jupyter notebook (Through VSCode)¶
Install VScode Extension "Python" and "Jupyter" on remote machine¶
Activate a Conda Environment (Through VSCode)¶
#Running a new UCloud run the following lines in the terminal to activate Conda:
sudo ln -s /work/miniconda3/bin/conda /usr/bin/conda
# Initiate Conda and reboot
conda init && bash -i
# Activate environment:
conda activate myenv
# Install ipykernel if not installed:
conda install ipykernel
#
python -m ipykernel install --user --name myenv --display-name "myenv"