替换repo源
清华源
删除snap
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| # snap list snap remove --purge gnome-42-2204 snap remove --purge gtk-common-themes snap remove --purge snap-store snap remove --purge snapd-desktop-integration snap remove --purge bare snap remove --purge firefox snap remove --purge firmware-updater snap remove --purge core22 snap remove --purge snapd
# dpkg --remove --force-remove-reinstreq firefox apt remove --auto-remove snapd rm -rf ~/snap/ /snap/ /var/lib/snapd/ /home/gjorn/snap/ apt-mark manual snapd dpkg --purge --force-depends snapd
echo "Package: snapd Pin: release a=* Pin-Priority: -10" | tee /etc/apt/preferences.d/nosnap.pref apt update
|
安装中文输入法
fcitx5
apt-get install -y fcitx5 fcitx5-configtool fcitx5-chinese-addons
mkdir -p ~/.config/autostart
touch ~/.config/autostart/fcitx5.desktop
1 2 3 4 5
| [Desktop Entry] Type=Application Name=Fcitx5 Exec=/usr/bin/fcitx5 X-GNOME-Autostart-enabled=true
|
chmod +x ~/.config/autostart/fcitx5.desktop
安装nvidia驱动
- 在bios中配置使用核显
- 关闭开源驱动 nouveau
lsmod | grep nouveau: 查看存在 nouveau 驱动
vim /etc/modprobe.d/blacklist-nouveau.conf 1 2
| blacklist nouveau options nouveau modeset=0
|
update-initramfs -u; reboot: 重启生效
- 安装nvidia驱动
ubuntu-drivers devices 查看合适的驱动
apt install -y nvidia-driver-xxx[-server][-open]: 安装合适的驱动
nvidia-smi: 查看是否存在显卡
- 在bios中配置使用独显
CUDA
安装: apt install nvidia-cuda-toolkit
检查: nvcc --version
Nvidia Official Guide
- Configure the production repository:
1 2 3 4
| curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
|
- Update the packages list from the repository:
sudo apt-get update
- Install the NVIDIA Container Toolkit packages:
1 2 3 4 5 6
| export NVIDIA_CONTAINER_TOOLKIT_VERSION=1.17.8-1 sudo apt-get install -y \ nvidia-container-toolkit=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \ nvidia-container-toolkit-base=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \ libnvidia-container-tools=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \ libnvidia-container1=${NVIDIA_CONTAINER_TOOLKIT_VERSION}
|
- 配置Docker使用Nvidia运行时
1 2
| sudo nvidia-ctk runtime configure --runtime=docker sudo systemctl restart docker
|
- 验证是否可用
sudo docker run --rm --gpus all nvidia/cuda:12.8.0-base-ubuntu24.04 nvidia-smi
CUDNN
CUda Deep Neural Network
安装: apt install nvidia-cudnn
验证:
1 2
| from torch.backends import cudnn print(cudnn.is_available())
|
gnome
新窗口生成在中央
gsettings set org.gnome.mutter center-new-windows true
科学上网
使用 clash tun 令chrome、terminal可以使用
clash-for-linux
下次重启切换到windows
在 /etc/bash.bashrc 中 source /etc/custom/custom_func
/etc/custom/custom_func
/etc/profile.d/custom_func
1 2 3 4 5 6 7 8 9 10 11 12
| #!/bin/bash
function switch2windows() { echo "switch to windows" # windwos entry index = 4 sudo grub-reboot 4 for ((i=3;i>0;i--)) { echo "$i seconds reboot" sleep 1 } reboot }
|
apt install无法获取dpkg lock
1 2 3
| function releaseDpkgLock() { sudo rm -f /var/cache/apt/archives/lock /var/lib/dpkg/lock }
|
开机挂载硬盘
修改 /etc/fstab,使用blkid查看每个硬盘的信息
1 2
| /dev/sda1 /mnt/repo1 ntfs defaults 0 0 /dev/sdb1 /mnt/repo2 ntfs defaults 0 0
|
自定义term打开终端
1 2 3 4 5 6 7 8 9 10 11 12 13
| function term() { if [ `whoami` == "root" ]; then echo "Can't upport in root" fi
if [ $# -eq 0 ]; then gnome-terminal --working-directory="$PWD" elif [ -d "$1" ]; then gnome-terminal --working-directory="$(realpath "$1")" else echo "Path not exist: $1" fi }
|
ssh配置文件
/etc/ssh/ssh_config 会 Include /etc/ssh/ssh_config.d/*.conf
1 2 3 4 5
| # /etc/ssh/ssh_config.d/node.conf Host server1 HostName 192.168.1.100 User username Port 22
|
给当前用户root权限
1 2 3
| sudo usermod -aG sudo $USER echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$USER sudo chmod 440 /etc/sudoers.d/$USER
|