ESC
输入关键词搜索文章
目录

安装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 |
+---------------------------------------------------------------------------------------+

事前列举

sudo

about the su and usermod

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,这实在太麻烦了。

  1. go to GitHub - chxuan/vimplus: :rocket:An automatic configuration program for vim
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

colorscheme:

bright: use gruvbox dark: use everforest

快捷键

  1. <leader>z: goyo mode(zen)
  2. <leader>f: MRU
  3. <c-f>: ctrlp
  4. <leader>o: buffer

插件

  1. 中文输入:Zfvimium
  2. 片段: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

  1. generate ssh-key: ssh-keygen -t rsa -b 4096 -C "xinyuzheng31@gmail.com"

  2. get the key: cat ~/.ssh/id_rsa.pub

  3. put it onto github

  4. 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有关的项。

mint

sudo apt install ibus-rime

hugo

  1. HUGO Downloading

  2. Download and install - The Go Programming Language

Go

  1. downloading
  2. rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.4.linux-amd64.tar.gz
  3. go to $HOME/.profile, and put this in the end export 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.

  1. Download the Latest Release: Visit the Hugo Releases page on GitHub and download the hugo_extended_x.xxx.x_Linux-64bit.tar.gz file.

  2. 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
  1. 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/
  1. Verify the Installation: Check the Hugo version to ensure the update was successful:
hugo version

anaconda

How to Install Anaconda in Ubuntu or Debian

  1. download anaconda sh file
  2. 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

debain12 cuda11.8

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&#39;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:

  1. 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 clean
    
  2. Update 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 dkms
    
  3. Download 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 update
    
  4. Install CUDA 11.8 and Driver

    Install CUDA 11.8, which includes the compatible driver.

    sudo apt-get -y install cuda
    
  5. Reboot Your System

    Reboot your computer to apply the changes.

    sudo reboot
    
  6. Set Up Environment Variables

    After rebooting, set up the environment variables for CUDA. Add the following lines to your ~/.bashrc file:

    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' >> ~/.bashrc
    

    Apply the changes:

    source ~/.bashrc
    
  7. Verify the Installation

    Verify that the CUDA toolkit and driver are correctly installed:

    nvcc --version
    nvidia-smi
    

pytorch

official

前提:已经安装好了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

可选软件