Recently, I frequently setup my environment on different cuda machines. Therefore, I keep a record of my environment config here. After this, we will have:
Customized zsh
C++ & cuda develop environement (with clangd)
Python develop environement (uv + pip)
First, we need to start from a docker image. I like the image from nvidia. It’s clean.
1 2 3 4
# In a remote machine docker pull nvidia/cuda:12.8.0-devel-ubuntu22.04 docker run -itd --shm-size 32g --gpus all --ipc=host --network=host --privileged --name cuda_dark nvidia/cuda:12.8.0-devel-ubuntu22.04 /usr/bin/bash docker exec -it cuda_dark /usr/bin/bash
In docker, we need to update and change to first.
1 2 3 4 5 6
# Now in docker apt update apt install zsh tmux git ccache ninja-build cmake curl wget vim python3 pip lsb-release software-properties-common gnupg -y chsh $(whoami) -s $(which zsh) # for ubuntu 24.04 image, you may need: apt install python3.12-venv
To use VSCode tunnel, we will need to download VScode and run ./code tunnel in a seperate terminal.
1 2 3 4 5 6 7 8 9 10
# Now in zsh zsh mkdir vscode cd vscode curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --output vscode_cli.tar.gz tar -xf vscode_cli.tar.gz # Now in tmux, we set up VSCode tunnel :) tmux ./code tunnel # Ctrl + B and then D, we leave tmux
# only on ubuntu 24.04, we can't install in system pip python3 -m venv .venv source .venv/bin/activate
# Now we need to restart zsh (or source ~/.zshrc) # we need to configure p10k... # after that, configure python pip install uv
# then add the following in ~/.zshrc # alias pip="uv pip" # alias pip3="uv pip3"
# When creating a venv uv venv source .venv/bin/activate uv pip install uv pip
# Some other things i may need pip install nvitop
My C++ environment (no need to set up things like --query-driver in docker).
1 2 3 4 5 6
# we need to set up clangd for C++ development wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh ./llvm.sh 19 rm llvm.sh update-alternatives --install /usr/bin/clangd llvm /usr/bin/clangd-19 100