Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Ubuntu 22.04 Workstation Setup: SSH, Remote Desktop, Miniconda, and PyTorch

Tech May 15 1

Disk Layout

Mount Size Purpose
/boot 512 MiB Kernel & GRUB
swap 16 GiB Virtual memory
/ rest OS, packages, user data

A separate /home partition is optional; keeping everything under / simplifies future resizing.

GPU Driver

Ubuntu 22.04 usually ships with a compatible NVIDIA driver. If not:

sudo ubuntu-drivers autoinstall
sudo reboot

Verify with nvidia-smi.

Package Manager Mirrors

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip install -U pip

SSH Server

sudo apt update && sudo apt install -y openssh-server
sudo systemctl enable --now ssh
sudo ufw allow OpenSSH
sudo ufw enable

Check status:

sudo systemctl status ssh

xrdp Remote Desktop

sudo apt install -y xrdp
sudo adduser xrdp ssl-cert
sudo systemctl restart xrdp
sudo ufw allow 3389

Test from any RDP client on port 3389.

Miniconda

mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/install.sh
bash ~/miniconda3/install.sh -b -u -p ~/miniconda3
~/miniconda3/bin/conda init bash
source ~/.bashrc
rm ~/miniconda3/install.sh

Conda mirrrors

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --set show_channel_urls yes

Replace ~/.condarc with:

channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

Python Environment & PyTorch

Create an isolated environment:

conda create -n dl python=3.10 -y
conda activate dl

Install PyTorch 2.1 + CUDA 11.8:

pip install torch==2.1.0+cu118 torchvision==0.16.0+cu118 torchaudio==2.1.0+cu118 \
  --index-url https://download.pytorch.org/whl/cu118

Common utilities:

pip install timm thop einops grad-cam albumentations pycocotools tidecv seaborn gpustat flask

OpenMMLab stack:

pip install -U openmim
mim install mmengine
mim install "mmcv>=2.0.0" -f https://download.openmmlab.com/mmcv/dist/cu118/torch2.1/index.html

User Management

Add a new user with sudo rights:

sudo adduser alice
sudo usermod -aG sudo alice

Delete user and home directory:

sudo deluser --remove-home alice

List sudoers:

getent group sudo

Mounting Additional Storage

List disks:

lsblk

Format and mount a new drive:

sudo mkfs.ext4 /dev/sdb1
sudo mkdir /data
sudo mount /dev/sdb1 /data
sudo blkid /dev/sdb1  # copy UUID
sudo nano /etc/fstab  # add UUID line

Example fstab entry:

UUID=xxxx-xxxx /data ext4 defaults 0 2

Monitoring

watch -n 1 nvidia-smi

Install gpustat for a concise view:

pip install gpustat
Tags: ubuntuSSH

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.