安装Linux系统
重装系统
设备信息
ubuntu20.04
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.171.04 Driver Version: 535.171.04 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| 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 3050 ... Off | 00000000:01:00.0 Off | N/A |
| N/A 51C P0 N/A / 80W | 8MiB / 4096MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 1491 G /usr/lib/xorg/Xorg 4MiB |
+---------------------------------------------------------------------------------------+
事前列举
- 要重装系统,首先需要备份重要数据,包括:
- Home
- 重装完系统以后要做的事情:
- 重新安装常用软件
- Code
- Zetero
- WPS
- obsidian
- verysync
- php相关软件
- GO
- Hugo
- Node.js
- 其他常用软件
- 安装驱动
- 安装字体
- 安装输入法
- 重新配置网络
- Linux声音处理
- Linux
- 重新配置环境变量
- 重新安装常用软件
sudo
In Debian, if you get information like this: bash: usermod: command not found (in latest Debian 11 install)
You probably used su to become root. Try using su - instead.
usermod is almost certainly installed. But it is in /usr/sbin/ and that directory is (by default) only in root's PATH, not in the PATH of non-root users. And if you use su to become root, you keep your user&39;s PATH. If you use su - instead, you get root's PATH.
sudo visudo
# Go to the section called User privilege specification.
# Add a user and the appropriate permissions. For example, for user1:
user1 ALL=(ALL:ALL) ALL
Downloading
sudo apt install git fish hugo vim cmake ibus-rime
vim
vimplus
我现在转到使用 ultimate vimrrc当作初始配置了:vimplus 需要自己安装ycm,这实在太麻烦了。
git clone https://github.com/chxuan/vimplus.git ~/.vimplus
cd ~/.vimplus
./install.sh //不加sudo
ultimate vimrc
git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
sh ~/.vim_runtime/install_awesome_vimrc.sh
add custom configs in ~/.vim_runtime/my_configs.vim.
Download custom plugins:
git clone https://github.com/preservim/tagbar ~/.vim_runtime/my_plugins/tagbar
git clone git@github.com:preservim/nerdcommenter.git ~/.vim_runtime/my_plugins/nerdcommenter
git clone git@github.com:sainnhe/everforest.git ~/.vim_runtime/my_plugins/everforest
git clone git@github.com:sheerun/vim-polyglot.git ~/.vim_runtime/my_plugins/vim-polyglot
git clone git@github.com:junegunn/vim-plug.git ~/.vim_runtime/my_plugins/vim-plug
bright: use gruvbox dark: use everforest
快捷键
<leader>z: goyo mode(zen)<leader>f: MRU<c-f>: ctrlp<leader>o: buffer
插件
- 中文输入:
Zfvimium - 片段:
ultisnips
允许自动切换输入法
我先是使用了 ZFVimIM,然后我发现 g3kb-switch 在linux上可以用,并且全平台可用。
事实证明可用。要想使用 g3kb-switch 实现我们想要的效果:自动切换输入法,我们需要分两步走,第一步:安装 g3kb-switch;第二步:vim内安装 vim-xkbswitch
我的配置如下:
let g:XkbSwitchEnabled = 1
let g:XkbSwitchLib = '/usr/local/lib/libg3kbswitch.so'
"echo libcall(g:XkbSwitchLib, 'Xkb_Swich_getXkbLayout', '')
let g:XkbSwitchNLayout = 'us'
"let g:XkbSwitchILayout = 'rime'
let b:XkbSwitchILayout = 'rime'
let g:XkbSwitchSkipFt = ['nerdtree']
git setting
generate ssh-key:
ssh-keygen -t rsa -b 4096 -C "xinyuzheng31@gmail.com"get the key:
cat ~/.ssh/id_rsa.pubput it onto github
pull repositories needed
git remote add origin <url>
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
input method
我使用的是ibus-rime, oh-my-mint的配置。最新版本中有一个bug,是上游使用的包不支持lua引起的。因此,为了要能够使用输入法,需要关闭所有*.schema.yaml中与lua有关的项。
sudo apt install ibus-rime
hugo
Go
- downloading
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.4.linux-amd64.tar.gz- go to
$HOME/.profile, and put this in the endexport PATH=$PATH:/usr/local/go/bin
Hugo
sudo apt install hugo
I don't know why, but this command download the Hugo of the version v0.92, which is too low to support the function findREsubmatch. So we need to download the needed version manually.
For the latest version, this method might not be as up-to-date as downloading directly from GitHub, but it is straightforward.
Download the Latest Release: Visit the Hugo Releases page on GitHub and download the
hugo_extended_x.xxx.x_Linux-64bit.tar.gzfile.Extract the Downloaded Archive: Navigate to the directory where you downloaded the file and extract it:
tar -xzvf hugo_extended_0.120.0_Linux-64bit.tar.gz
- Move the Hugo Binary to a Directory in Your PATH: Move the extracted hugo binary to a directory that is included in your system's PATH, such as
/usr/bin.
sudo mv hugo /usr/local/bin/
- Verify the Installation: Check the Hugo version to ensure the update was successful:
hugo version
anaconda
How to Install Anaconda in Ubuntu or Debian
- download anaconda sh file
- bash the file
nvidia
In fact, finally I found that we don't need to download CUDA manually, the downloading command of pytorch will help us to achieve it.
driver
How to Install Nvidia Drivers on Debian
https://ubuntu.com/server/docs/nvidia-drivers-installation
CUDA Toolkit 11.8 Downloads | NVIDIA Developer
sudo apt-get install -y cuda-drivers
cuda
In the system of Debian 12, we can install with the following command:
Base Installer:
wget https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo add-apt-repository contrib
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-5
BUT! I can't use cuda 12.5 ! It&39;s not what I want for pytorch.
we need to purge
sudo apt-get purge nvidia-*
sudo apt-get autoremove
sudo apt-get clean
ubuntu20.04.4 Cuda 11.8
For CUDA 11.8, you need at least NVIDIA driver version 520.61.05.
To install CUDA 11.8 on Ubuntu 20.04, you need to ensure that your NVIDIA driver version is compatible with CUDA 11.8. According to the NVIDIA CUDA Installation Guide for Linux, CUDA 11.8 requires NVIDIA driver version 520.61.05 or later.
Here is a step-by-step guide to installing CUDA 11.8 along with the appropriate driver:
Purge Existing NVIDIA Drivers and Libraries
Remove any existing NVIDIA drivers to avoid conflicts.
sudo apt-get purge nvidia-* sudo apt-get autoremove sudo apt-get cleanUpdate and Install Required Dependencies
Ensure your system is up-to-date and install necessary dependencies.
sudo apt-get update sudo apt-get install build-essential dkmsDownload CUDA 11.8 Toolkit
Visit the CUDA Toolkit 11.8 download page and select the appropriate version for your system. For Ubuntu 20.04, you can download the
.deb (local)file.Alternatively, you can use the following commands to download and install:
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-ubuntu2004-11-8-local_11.8.0-520.61.05-1_amd64.deb sudo dpkg -i cuda-repo-ubuntu2004-11-8-local_11.8.0-520.61.05-1_amd64.deb sudo cp /var/cuda-repo-ubuntu2004-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/ sudo apt-get updateInstall CUDA 11.8 and Driver
Install CUDA 11.8, which includes the compatible driver.
sudo apt-get -y install cudaReboot Your System
Reboot your computer to apply the changes.
sudo rebootSet Up Environment Variables
After rebooting, set up the environment variables for CUDA. Add the following lines to your
~/.bashrcfile:echo 'export PATH=/usr/local/cuda-11.8/bin:$PATH' >> ~/.bashrc echo 'export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH' >> ~/.bashrcApply the changes:
source ~/.bashrcVerify the Installation
Verify that the CUDA toolkit and driver are correctly installed:
nvcc --version nvidia-smi
pytorch
前提:已经安装好了anaconda
# 创建虚拟环境
conda create -n env_name python==3.x jupyter-lab numpy matplotlib pandas
检查cuda是否可用
import torch
torch.cuda.is_available()
PHP
refer to PHP#安装.
mysql: mariadb
service doesn't exist: stackoverflow
可选软件
- 截屏:flameshot,直接在snapshop中下载即可,参考这个链接
- obsidian: 笔记软件,不过由于我现在都直接用vim来管理笔记,所以可能不太用得到了。