本文最后更新于:几秒前
这里记录了我自己平时常见的 Ubuntu 系统安装和操作的问题,现在做个记录以备查。
系统安装
解压
1 2 3 4
| #解压缩 tar -xzvf ***.tar.gz tar -xjvf ***.tar.bz2 unzip text.zip
|
Ubuntu 无法挂载 NTFS 磁盘
可能因为在挂载 wimdows 盘后,强制关机造成的,可使用
来修复。其中,_**为具体哪个盘,例如 sudo ntfsfix /dev/sda4
安装 Nvidia 显卡驱动后, 重启依然卡死。
安装完显卡驱动后,系统需要重启加载驱动,注意如果按照上述流程进行驱动安装的同学,那在重启系统时,会出现一个蓝色背景的界面 perform mok management , 本人在这一步选择了 continue reboot, 导致新安装的 N 卡驱动没有加载,正确的做法如下:
- 当进入蓝色背景的界面 perform mok management 后,选择 enroll mok,
- 进入 enroll mok 界面,选择 continue,
- 进入 enroll the key 界面,选择 yes,
- 接下来输入你在安装驱动时输入的密码,
- 之后会跳到蓝色背景的界面 perform mok management 选择第一个 reboot 这样,重启后 N 卡驱动就加载了,恭喜你,Ubuntu 安装成功。
Cuda deb
Installation Instructions:
1 2 3 4 5 6 7
| - wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin - sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600 - wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb - sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb - sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub - sudo apt-get update - sudo apt-get -y install cuda
|
Cudnn 安装
1 2 3 4 5 6
| sudo cp cuda/include/cudnn.h /usr/local/cuda/include sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64 sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn* sudo ln -sf libcudnn.so.7.6.5 libcudnn.so.7 #重建软连接 sudo ln -sf libcudnn.so.7 libcudnn.so sudo ldconfig
|
Cudnn 版本
cuda 版本 cat /usr/local/cuda/version.txt
cudnn 版本 cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
环境配置
GIT
1 2 3
| ssh-keygen -t rsa -b 4096 -C "waynehfut@outlook.com" git config --global user.name "Hao Wang" git config --global user.email "waynehfut@outlook.com"
|
ZSH
1
| sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
TMUX
安装 Tmux 后,终端输入tmux
,之后可以使用Ctrl+B
的快捷键进入命令模式; 命令模式下:
Shift+%
表示左右分屏;
Shift+"
表示上下分屏;
↑
表示向上切换分屏
↓
表示向下切换分屏
←
表示向左切换分屏
→
表示向右切换分屏
tmux new -s <session-name>
新建会话
Ctrl+b d
离开会话
tmux ls
列出会话
tmux attach -t <session-name>
重新打开会话
tmux kill-session -t <session-name>
杀死会话
一个最简单的实践:
- 新建会话
tmux new -s my_session
- 在 Tmux 窗口运行所需的程序。
- 按下快捷键
Ctrl+b d
将会话分离。
- 下次使用时,重新连接到会话
tmux attach -t my_session
。
Miniconda
1
| wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
|
NPM & Nodejs
强烈推荐在 WSL 等类 Linux 中使用 NVM 管理 npm 版本 微软关于 WSL2 安装 NVM 的教程
Hexo 需要使用 node 14.x nvm install 14 && nvm use 14
如果仅需要一个特定的版本:
1 2 3 4
| mkdir ~/.npm-global npm config set prefix '~/.npm-global' export PATH=~/.npm-global/bin:$PATH source ~/.profile
|
Resolving EACCES permissions errors when installing packages globally
Hexo
软件配置
VSCODE
1
| wget -qO- https://raw.githubusercontent.com/cra0zy/code-nautilus/master/install.sh | bash
|
Extensions
Tweak Theme
Tweak setting
空格预览增强工具
1
| sudo apt install gnome-sushi
|
fusuma 触控板手势
https://github.com/iberianpig/fusuma
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| swipe: 3: left: command: 'xdotool key alt+Left' right: command: 'xdotool key alt+Right' up: command: 'xdotool key super+s' down: command: 'xdotool key super+a' 4: left: command: 'xdotool key super+Left' right: command: 'xdotool key super+Right' up: command: 'xdotool key super+Up' down: command: 'xdotool key super+Down'
pinch: 2: in: command: 'xdotool key ctrl+equal' out: command: 'xdotool key ctrl+minus' 4: in: command: 'xdotool key super+d' out: command: 'xdotool key super+s'
threshold: swipe: 0.3 pinch: 0.1
interval: swipe: 1 pinch: 1
|
Deepin-wine 容器
Repo: https://github.com/wszqkzqk/deepin-wine-ubuntu
1 2 3 4 5 6 7
| git clone https://gitee.com/wszqkzqk/deepin-wine-for-ubuntu.git cd deepin-wine-for-ubuntu chmod +x ./install_2.8.22.sh ./install_2.8.22.sh wget https://mirrors.aliyun.com/deepin/pool/non-free/d/deepin.com.wechat/deepin.com.wechat_2.6.8.65deepin0_i386.deb sudo dpkg -i deepin.com.wechat_2.6.8.65deepin0_i386.deb sudo apt install fonts-wqy-microhei fonts-wqy-zenhei # 解决中文字体变方块的问题
|
修复 Wechat 中文输入
1 2 3
| cd /opt/deepinwine/tools sudo gedit run.sh sudo gedit run_v2.sh
|
修改run.sh
和run_v2.sh
如下:
1 2 3 4 5 6 7
| #WINE_CMD="deepin-wine" WINE_CMD="LC_ALL=zh_CN.UTF-8 deepin-wine"
#added by user export GTK_IM_MODULE="ibus" export QT_IM_MODULE="ibus" export XMODIFIERS="@im=ibus
|
之后切换一下输入法就可以激活中文输入了。