Mengyang Gao's Page 高梦扬的主页
RSS icon RSS

Ubuntu 22.04 Setup Notes

first

sudo apt update
sudo apt upgrade
sudo apt install gcc make vim git

forbidden integrated GPU and use NVIDIA GPU

cd /etc/modprobe.d/
sudo nano blacklist-nouveau.conf

inside the file, add

blacklist nouveau
options nouveau modeset=0
  1. Verify the content
cat blacklist-nouveau.conf
sudo update-initramfs -u
sudo reboot
lsmod | grep nouveau # should be no output
  1. set NVIDIA GPU
export __NV_PRIME_RENDER_OFFLOAD=1
export __GLX_VENDOR_LIBRARY_NAME=nvidia

CUDA

  1. uninstall old version CUDA
sudo apt --purge remove "*cublas*" "*cufft*" "*curand*" "*cusolver*" "*cusparse*" "*npp*" "*nvjpeg*" "cuda*" "nsight*"
sudo apt autoremove
  1. add NVIDIA official APT repo
cd ~
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update
  1. install new version CUDA

check whether you have installed NVIDIA’s driver by entering nvidia-smi
the result will be like:

Fri Nov  7 22:21:25 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 580.95.05              Driver Version: 580.95.05      CUDA Version: 13.0     |
+-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 5060 ...    Off |   00000000:01:00.0 Off |                  N/A |
| N/A   35C    P2             11W /   60W |      15MiB /   8151MiB |     26%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A            1760      G   /usr/lib/xorg/Xorg                        4MiB |
+-----------------------------------------------------------------------------------------+

see the Driver Version: item.
If not:

sudo apt install -y cuda-12-6

if you have already install, you just need to add cuda toolkit

sudo apt install -y cuda-toolkit-12-6
  1. Set environment
echo 'export PATH=/usr/local/cuda-12.6/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.6/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
  1. Verify
nvcc -V

should show an info like: nvcc: NVIDIA (R) Cuda compiler release 12.6, ...

miniconda

mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm ~/miniconda3/miniconda.sh
  1. source it
source ~/miniconda3/bin/activate
  1. initialize in all shells
conda init --all

vscode

  • use space to change a new line in markdown file

in ~/.config/Code/User/settings.json, add

{
  "markdown.preview.breaks": true
}

Chinese Input Method

(1)在设定中添加中文语言支持:Settings -> Region & Language -> Manage installed Languages -> Install / Remove Languages -> 点选 Chinese (simplified) -> Apply
(2)命令更新系统,确保下载完整语言包:sudo apt-get update && sudo apt-get upgrade
(3)重启系统:reboot
(4)添加中文拼音输入法:Settings -> Region & Language -> Input Sources -> + -> Chinese -> Chinese (Intelligent Pinyin)